Cant display the image after applyting exposed elbp function in python
I am trying to display an image after applying elbp function to a gray-scale image, the function was exposed manually in the face module for python. here's the code:
LBP = cv2.face.elbp(gray_roi,1,8)
cv2.imshow("Face",LBP)
But however, what I got is a pure black window,also I noticed that the cols and rows are always smaller than the original image by 2,here is the error information:
could not broadcast input array from shape (95,95) into shape (97,97)
I noticed one other ppl asked the same question but was using c++ instead:
But what I cant understand is what he meant by normalized the image to fit the screen rendering range?
Your values in the black image are less than 10, so you cannot see them, they are almost black. Do a normalize with
normType=NORM_MINMAX
on the lbp image (or a copy of it), then display it.a:) put a cv2.waitKey(some_millis) behind imshow() (yawn....)
b:) with lbp images you have to spare a border of the size of the neighbour radius, but you'd have to show us the code, to know what's happening exactly.
c:) where is that code from ? it's not opencv's.
Hi! Thx for the solution, I tried to normalize the image with :
but it doesn't work, what I did was to multiply the image matrix by a value like 32 ,and finally I can see the image,I wonder why normallize doesnt work though
and regarding to @berak questions a:) why do I need to put wait after imshow()? c:) the code is from the face module in the opencv_contrib,here is the directory: "/home/pi/opencv_contrib-3.0.0/modules/face/src/lbph_faces.cpp"
"a:) why do I need to put wait after imshow()?" Because the displaying (rendering) is done in the waitKey()