Ask Your Question

mcsmurf's profile - activity

2014-12-25 16:55:55 -0600 received badge  Organizer (source)
2014-12-25 16:54:12 -0600 received badge  Supporter (source)
2014-12-07 07:19:40 -0600 answered a question i am getting this error please help me

Can you post your code here? Remember to use the preformatted text (Ctrl+K) option to paste the code or output of the compiler. To me it looks like you built a header loop somewhere. Like you include a header file test1.h which includes test2.h. And test2.h includes test1.h (and then you have a loop).

2014-12-06 03:44:58 -0600 asked a question calcHist not returning expected values?

Hi, I'm trying to calculate a histogram with OpenCV 2.4.10 with Python on Windows. I use this code to show the image, calculate and print the histogram:

diff2_img = cv2.imread("result.png", cv2.CV_LOAD_IMAGE_GRAYSCALE)
cv2.imshow("cropped", diff2_img)
cv2.waitKey(0)
hist = cv2.calcHist(diff2_img, [0], None, [256], [0, 256])
for s in hist:
  print s

I used the image at http://abload.de/img/result2vkw7.png to test this. But somehow only one entry in the array is !=0, it has a value of "[ 800.]" (is this the numbers of pixels...?). I would have expected two entries !=0, the one for the white area and the one for the gray area. When I use

from matplotlib import pyplot as plt
plt.hist(diff2_img.ravel(), 256, [0, 256])
plt.show()

for comparision, it looks fine (two bars: A small one for the gray area, a big one for the white area). Is my code above wrong?

2014-12-06 03:42:28 -0600 asked a question calcHist not returning expected values?

Hi, I'm trying to calculate a histogram with OpenCV 2.4.10 with Python on Windows. I use this code to show the image, calculate and print the histogram:

diff2_img = cv2.imread("result.png", cv2.CV_LOAD_IMAGE_GRAYSCALE)
cv2.imshow("cropped", diff2_img)
cv2.waitKey(0)
hist = cv2.calcHist(diff2_img, [0], None, [256], [0, 256])
for s in hist:
  print s

I used the image at http://abload.de/img/result2vkw7.png to test this. But somehow only one entry in the array is !=0, it has a value of "[ 800.]" (is this the numbers of pixels...?). I would have expected two entries !=0, the one for the white area and the one for the gray area. When I use

from matplotlib import pyplot as plt
plt.hist(diff2_img.ravel(), 256, [0, 256])
plt.show()

for comparision, it looks fine (two bars: A small one for the gray area, a big one for the white area). Is my code above wrong?