MATLAB: How to convert matrix to image??

how do i convert matrix containing 1st column-x position 2nd column-y position 3rd column-height 4th column-width into output image it should compare with the original image and extract the components from it.
Please do help me

Best Answer

Guessing at what you mean about "compare with the original image and extract the components from it":
Assuming the control information is in YourMatrix and that the original image is YourImage:
ncol = size(YourMatrix, 1);
outputs = cell(ncol,1);
for K = 1 : ncol
x = YourMatrix(K,1);
y = YourMatrix(K,2);
high = YourMatrix(K,3);
wide = YourMatrix(K,4);
this_extract = YourImage(y:y+high-1, x:x+wide-1, :);
outputs{K} = this_extract;
end
Now outputs is a cell array containing the sub-sections of the image.
Somehow, I suspect that what you want to do is feature extraction based on the extracted portions and compare the results against a database of features of OCR'd characters to figure out which character you are probably looking at. Not that you said anything like that, but...
By the way, please re-check that the height is in the third position and the width is in the fourth position. If this matrix is being output by one of the extract_features routines then it almost certainly has the width in the third position and the height in the fourth position.