1
votes

Until now, the previous versions of OpenCV JAVA API offered get() and put() methods in order to fetch and manipulate the individual pixels in a Mat image. But in OpenCV 3.0.0-1.1 Java API those methods are deprecated. So how can individual pixels be manipulated in this version.

Here is a list of deprecated methods: http://bytedeco.org/javacpp-presets/opencv/apidocs/deprecated-list.html

When I'm using the put() method in HIPI v2.0 (which supports latest OpenCV API), I'm getting the following error:

Image showing the error

What can I do to change particular pixels (given the indices)?

1
please, do not confuse opencv's java wrappers with bytedeco/javacv, 2 totally seperate pair of shoes.berak
I'm a total newbie to HIPI and Opencv (or even image processing for that matters).i don't understand what exactly is bytedeco/javacv?bytedeco/javacpp is what hipi uses for accessing opencv methods in the new version i.e. v2.0(it has in built support for opencv)Swapnil

1 Answers

1
votes

The recommended approach is via an Indexer as introduced in this post:
http://bytedeco.org/news/2014/12/23/third-release/

So, for example, in the case of a typical BGR/RGB 8-bit image:

UByteIndexer idx = mat.createIndexer();
idx.put(x, y, z, 255);
assert idx.get(x, y, z) == 255;