From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Image Reconstruction Issue

Solved!
Go to solution

Hello,

 

As a test set up I have created a BMP image, which I then decompose and then want to reconstruct.

 

Decomposition:

Into 1D array, 30pixels at a time, row by row (180 pixel wide image = 6 iterations) as can be seen in the first while loop of the image.

Hence first 30 elements of the 1D array will be pixels 0,0 - 0,29, next thirty will be 1,0-1,29 etc.

 

I then attempt to reconstruct the image, and it looks like it works except for the last row of 30 pixels where the image does WEIRD stuff, it looks skewed...

 

I have attached both my labview code, and picture of the reconstructed image.

 

The decomposition is a little confusing and if necessary I can provide a picture description.

 

Thank you.

Download All
0 Kudos
Message 1 of 9
(3,677 Views)

algoballer wrote: 

I have attached both my labview code, and picture of the reconstructed image.


No, you have not! A picture of LabVIEW code is not LabVIEW code.

 

Please attach the actual VI and the image you are processing.

 

(Your code image show quite a few very (very!) questionable constructs that make no sense whatsoever. e.g. use while loops as for loops, reshape...build...concatenate tunnel, overuse of insert into and delete from array. etc.etc.).

0 Kudos
Message 2 of 9
(3,669 Views)

I have attached the labview VI, the picture however is a .bmp format so I can't attach it. I have attached it as a .png.

 

Thank you.

Download All
0 Kudos
Message 3 of 9
(3,657 Views)

Just to clear thing up: while loops instead of for are a personal preference. The reshape array and everything on the "left half" of the VI is for the decomposition of the 2D array into an appropriate 1D array format. This part will be done by the FPGA, I'm just doing it for testing purposes.

 

The "right half" is reconstruction back into the 2D array.

0 Kudos
Message 4 of 9
(3,641 Views)

Your PNG does not contain a color ramp, thus the outputs are blank. Can you zip the actual bmp file instead?

0 Kudos
Message 5 of 9
(3,636 Views)

Attached zip .bmp file. The file is Black and white intentionally.

0 Kudos
Message 6 of 9
(3,625 Views)

Just as an update, I fixed the problem it was silly. But if you have any suggestion on how to do the "reconstruction" more efficiently I would really appreciate the help.

0 Kudos
Message 7 of 9
(3,618 Views)
Solution
Accepted by topic author algoballer

Yes, your bug was in the first loop. Here's what I would do instead.

 

(I modified so it works on the png and without the color map). There are quite a few things that can still be improved, but this should get you started.

 

I think the use of "insert into array" in your last loop is incorrect, because it pushes the initialized array elements over, making the result twice the size. Replace array subset seems more correct, keeping the array at the initialized size.

 

Message 8 of 9
(3,613 Views)

Thank you for your help, did not know how to use those functions before!

0 Kudos
Message 9 of 9
(3,597 Views)