Closed GoogleCodeExporter closed 8 years ago
How about:
gradmat = cv.Mat()
gradmat = cv.Mat(cv.Size(320, 200), cv.CV_8UC3, cv.Scalar(20, 30, 40))
Pls take a look at the demo package. There are a few examples there.
Cheers,
Minh-Tri
Original comment by pmtri80@gmail.com
on 2 Sep 2010 at 8:55
I use gradmat = cv.Mat(), then the argument part is correct now, but when i try
to write gradmat as an image, i get this error,
OpenCV Error: Assertion failed (image.channels() == 1 || image.channels() == 3
|| image.channels() == 4) in imwrite_, file
M:\programming\packages\opencv\workspace\2.1\OpenCV-2.1.0\src\highgui\loadsave.c
pp, line 272
Traceback (most recent call last):
File "D:\Research\Experiments\Hog\src\hogtest.py", line 27, in <module>
pcv.imwrite("gradimg.jpg", gradmat)
RuntimeError:
M:\programming\packages\opencv\workspace\2.1\OpenCV-2.1.0\src\highgui\loadsave.c
pp:272: error: (-215) image.channels() == 1 || image.channels() == 3 ||
image.channels() == 4 in function imwrite_
why the Mat's channels is 2 and how to solve this error? thank you in advance.
Regards,
Kei
Original comment by liangji...@gmail.com
on 2 Sep 2010 at 10:51
Hi Kei,
To be frank, I don't really know how that computeGradient() function works. I
doubt it produces a gradient image, in which each pixel is a 2D vector that
represents a gradient vector. Perhaps that's why the number of channels is 2.
Cheers,
Minh-Tri
Original comment by pmtri80@gmail.com
on 2 Sep 2010 at 11:07
I assume you've fixed the issue. I'd like to close the issue. Feel free to open
a new one if you have other issues.
Cheers,
Minh-Tri
Original comment by pmtri80@gmail.com
on 5 Sep 2010 at 11:59
okay..
Original comment by liangji...@gmail.com
on 5 Sep 2010 at 1:16
Original issue reported on code.google.com by
liangji...@gmail.com
on 2 Sep 2010 at 8:31