Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
217 views
in Technique[技术] by (71.8m points)

computer vision - OpenCV image shows weird glare after un-normalizing with * 255

I ran a frame through neural style transfer with MobileSSD. Here is a picture of the problem I am running into, the middle one is the one producing the weird glares: enter image description here You must normalize the data like this to perform forward propagation with MobileSSD:

               (h, w) = noise_picture.shape[:2]

                blob2 = cv2.dnn.blobFromImage(noise_picture, 1.0, (w, h), (103.939, 116.779, 123.680), swapRB=False, crop=False)
                NTSnet.setInput(blob2)
                output = NTSnet.forward()
                output = output.reshape((3, output.shape[2], output.shape[3]))
                output[0] += 103.939
                output[1] += 116.779
                output[2] += 123.680
                output /= 255.0
                output = output.transpose(1,2,0)

The weird thing is that if I were to imshow this output thing, which is divided all by 255 (and thus between [0,1], it will show the right most picture in my 3 pictures. But if I add it to a pitch black image with:

black_background[startY:endY, startX:endX] = output

And if I imshow black_background, it wouldn't work even though the range of values should also be [0,1]. However, when I do

black_background[startY:endY, startX:endX] = output * 255

Which unnormalizes the data (correct me if I am wrong). It does work, but it shows the middle picture with the weird glare, any insights? Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...