I create a Mat variable in my program, but when I pass it directly to a function, it has different manner compare to when I write it with imwrite and again read it in function with imread.
Why this is happening?
The correct form for me is when I write and read the image, but in this case program have to access to hard 2 times and it makes the program slow.
How I can prevent it and use my Mat variable directly?
If you don't need to view your Image using any other application, you could write your Mat object onto an XML/YAML class using OpenCV's built in FileStorage Implementation. Following is a sample :-