Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

How to change the values of HSV channels of a pixel using OpenCV4Android?

$
0
0
The first of the following two images, `rgbaMat.bmp`, is a `5px*5px` `.bmp` image in `RGBA` format. This image was read from sdcard using `Highgui.imread` and then converted to `HSV` using `Imgproc.cvtColor(rgbaMat, hsvMat, Imgproc.COLOR_BGR2HSV);` resulting in `hsvMat.bmp` (the second image): [![enter image description here][1]][1] [![enter image description here][2]][2] The following are the same images enlarged to `100px*100px` in MS Paint, for viewing purposes. [![enter image description here][3]][3] [![enter image description here][4]][4] Then after executing the following code, the image I got `changedMat.bmp` is given as follows, followed by its enlarged version. [![enter image description here][5]][5] [![enter image description here][6]][6] **The problem is that what I expected when writing the code was that the alternate pixels should have *white* (`H=0, S=0, V=255`) and *black* (``) hues respectively, as can be checked [in the HSV section on this website][7]. But what I am getting is red and black.** **The question is why? Where am I going wrong?** public void doProcessing(View view) { Mat rgbaMat = Highgui.imread("/mnt/sdcard/DCIM/rgbaMat.bmp"); Mat hsvMat = new Mat(); Imgproc.cvtColor(rgbaMat, hsvMat, Imgproc.COLOR_BGR2HSV); Highgui.imwrite("/mnt/sdcard/DCIM/hsvMat.bmp", hsvMat);//check int counter=1; for (int firstCoordinate = 0; firstCoordinate

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>