how to store 2*2 multi images to create a single image of size 250*250?

2 次查看(过去 30 天)
Sir, I'm trying to implement a pixel level image fusion on a actel fpga board for that i have to cut 250x250 image into 2x2 images. I have used nested for loop. For 250x250 i'm getting proper fused image but for 2x2 after some iteration it is showing error saying "Matrix must be positive definite" . How to debug this error and also i'm facing problem while storing those images in a single 250x250 image.
My project code and images i have used are attached with this link

采纳的回答

Mohammad Abouali
Mohammad Abouali 2014-12-12
(1) you forgot the attachment
(2) instead of dividing your image into blocks using nested loops use im2col() function. That automatically retrieves the block in your image as columns so you get 4x16384 matrix where each column is one block of your image. Later you can use col2im to do the reverse, if needed.
  2 个评论
Mohammad Abouali
Mohammad Abouali 2014-12-12
编辑:Mohammad Abouali 2014-12-12
there is also blockproc() functions that applies a function on blocks of image. You can run those block in parallel too. May be this one is more useful in your case.
It has this general form:
outputImage=blockproc(inputImage,[2 2], func);
where inputImage is your input image. You might need to combine your 4 bands into one image such as:
inputImage=cat(3,RedBand,GreenBand,BlueBand,NIRBand);
[2 2] is your block size so blocks of 2 pixel by 2pixel and func is the function handle to the procedure or computation that you want to be done on each block of the image.
To process the blocks in parallel do
outputImage=blockproc(inputImage,[2 2], func,'UseParallel',true);
You need to have parallel processing toolbox though; otherwise, it would run in serial mode.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by