help-octave
[Top][All Lists]

## Re: Last Turn : Image Processing and Matrix values

 From: Nicholas Jankowski Subject: Re: Last Turn : Image Processing and Matrix values Date: Wed, 26 Oct 2016 16:31:29 -0400

On Wed, Oct 26, 2016 at 3:07 PM, Julien563 wrote:
Hello evryone,

I finally (almost) finished my project in IT, to finalize I would need one
last time your advice on the matter.
I insert a bmp format color image, 16-bit and trying to apply various image
transformations.
In fact I apply a transformation that will change the appearance of the
image. I simply moves the pixels of my image to another location. It's that
simple. All deflected pixels are placed in a matrix B. Knowing that the
original image was decomposed into a matrix A by the following: A = imread (
'test2.bmp').
So I apply the changes, everything works fine but my output image is
completely disgusting. It is black and white and I can not see the
transformations. Also knowing that the changes made have been inserted in
the matrix B, it should not merge the matrix A with the matrix B?

Without seeing your code I'm guessing here:

for a color image, imread should produce a MxNx3 matrix that you named A.

DON'T FORGET, 1 pixel has three values (one for R , G, and B colors). your MxN image is MxNx3, where the 3rd dimension is a different 'color'. If you want to move a pixel, you must move that value on all 3 of the color pages.

To produce a transformed image B, your transformation function should also produce a MxNx3 matrix.  I'm not sure what you mean by merging A with B.  If B only holds the pixels that have been changed, then it is not a complete image.  Perhaps you need to copy non-empty elements of B back into A and then save A as your new image?

Or, you could first copy A to B without any changes. Then apply your transformation to A, putting the output of the transformation into the correct location in B.  In that case B would be a complete image where you have just changed some pixels based on your transformation function.

You should be able to create your output bmp from imwrite(B, 'outputimage.bmp').

reply via email to