2016-05-20 04:12:48 -0600 | received badge | ● Nice Question (source) |
2015-06-13 23:24:21 -0600 | received badge | ● Famous Question (source) |
2014-10-31 12:31:16 -0600 | received badge | ● Notable Question (source) |
2014-07-22 01:53:33 -0600 | received badge | ● Popular Question (source) |
2013-06-13 09:43:25 -0600 | received badge | ● Student (source) |
2013-06-11 12:20:59 -0600 | commented question | Using get() and put() to access pixel values in JAVA One more note: Using second method is possible only if the matrix is continuous. We can check this by isContinuous() flag. Though, this will be the case most of the time, its a good idea to do a check before. |
2013-06-11 12:03:02 -0600 | answered a question | How to edit/reading pixels from Mat(Vec3b) using Java Hey, I was stuck on this yesterday too. There are two ways of doing this. Here, I have explained both the methods - http://answers.opencv.org/question/14961/using-get-and-put-to-access-pixel-values-in-java/ Let me know if you have any other questions. |
2013-06-11 11:59:30 -0600 | commented question | Using get() and put() to access pixel values in JAVA Posting the answer here as its not letting me answer my own question. It was happening because of byte() casting. I changed the data type of mat image in second case to CV_64FC3 so that I can use double[] instead of byte[] and it solved the problem. FYI, I also did some time measurement and using second methos is way faster than first method. |
2013-06-11 11:57:13 -0600 | commented question | Using get() and put() to access pixel values in JAVA As far as I know, there is no other way of working directly with pixels in java openCV. But, I started working with it just two days back so might not be aware of any existing other methods. I wanted to try out both these two methods to know the performance of these two approaches. Please let me know if you know of any other easy way of doing this. |
2013-06-10 19:39:25 -0600 | received badge | ● Editor (source) |
2013-06-10 19:36:12 -0600 | asked a question | Using get() and put() to access pixel values in JAVA I am a beginner in using OpenCV for JAVA. I want to access individual pixel values of an image matrix. Since, JAVA jar for OpenCV doesn't offer nice functions like C++, I ran into some trouble. After lot of searching, I found out two different methods to do that though they are not explained properly (not even in documentation). We can do that either using get() and put() functions or by converting the mat data into a primitive java type such as arrays. I tried both but getting different output results! Please help explaining what am I doing wrong. Am I using them wrong or some other silly problem. I am still a newbie so please forgive if its a stupid question. :) CASE 1: Using get() function CASE 2: Using Array Now according to my understanding they both should do the same thing. They both access the individual pixel values (all 3 channels) and making it half. I am getting no error after running. But, the output image I am getting is different in these two cases. Can someone please explain what is the issue? May be I don't understand exactly how get() function works? Is it because of the byte() casting? Please help. Thanks! |