Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Appending local binary pattern of image (having 200 channels) taken over 3 channels at a time

C:\fakepath\opencv_Code_doubt.PNG

I am unable to append the local binary patterns of image having 200 channels taking 3 channels at a time. hsi_data is my image,img_lbp is local binary pattern of my image hsi_data taking 3 channels at a time. I want to append all the local binary patterns taken over 3 channels to img_lbp_appended. Please refer to my code attached. Can anyone tell me my mistake.

click to hide/show revision 2
None

updated 2019-11-02 01:55:18 -0600

berak gravatar image

Appending local binary pattern of image (having 200 channels) taken over 3 channels at a time

C:\fakepath\opencv_Code_doubt.PNG

I am unable to append the local binary patterns of image having 200 channels taking 3 channels at a time. hsi_data is my image,img_lbp is local binary pattern of my image hsi_data taking 3 channels at a time. I want to append all the local binary patterns taken over 3 channels to img_lbp_appended. Please refer to my code attached. Can anyone tell me my mistake.

for k in range(0,199,3): if k==198: break else: image_file = hsi_data[:,:,k:k+3] img_bgr = image_file height, width, channel = img_bgr.shape img_gray = cv2.cvtColor(img_bgr,cv2.COLOR_BGR2GRAY) img_lbp = np.zeros((height, width,3), np.uint8)

for i in range(0, height):
  for j in range(0, width):
    img_lbp[i, j] = lbp_calculated_pixel(img_gray, i, j)
img_lbp_appended=np.zeros((height, width,200),np.uint8)
img_lbp_appended=np.append(img_lbp_appended,img_lbp,axis=2)
click to hide/show revision 3
None

updated 2019-11-02 02:02:57 -0600

berak gravatar image

Appending local binary pattern of image (having 200 channels) taken over 3 channels at a time

I am unable to append the local binary patterns of image having 200 channels taking 3 channels at a time. hsi_data is my image,img_lbp is local binary pattern of my image hsi_data taking 3 channels at a time. I want to append all the local binary patterns taken over 3 channels to img_lbp_appended. Please refer to my code attached. Can anyone tell me my mistake.mistake. ..

for k in range(0,199,3):
   if k==198:
     break
   else:
     image_file = hsi_data[:,:,k:k+3]
     img_bgr = image_file
     height, width, channel = img_bgr.shape
     img_gray = cv2.cvtColor(img_bgr,cv2.COLOR_BGR2GRAY)
     img_lbp = np.zeros((height, width,3), np.uint8)

np.uint8)

     for i in range(0, height):
   for j in range(0, width):
     img_lbp[i, j] = lbp_calculated_pixel(img_gray, i, j)
 img_lbp_appended=np.zeros((height, width,200),np.uint8)
 img_lbp_appended=np.append(img_lbp_appended,img_lbp,axis=2)

..