C code to matlab code - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

C code to matlab code

sb79sb79 Posts: 6Member
Hi to all,

I need some changes in my matlab code. The code u see below is created by me, I missed something in it. so I need your help to fix it.

Let me explain code.

Every pixel in the input image will be examined in left-right and top-bottom order. The process starts when a start pixel is found. The image index will be shifted forward by maxInterval. If the end pixel is found, pixel will be added to pixel back to the start pixel. When the operation moves to next pixel, the same procedure will be repeated.






Code In MAtlab (see only the function-----fill_function)


[code]

[r,c]=size(IDilated);
interval = 20;

for i=1:r
for j=1:c - interval -1
% startPixel1 = IDilated(i,j);
% if IDilated(i,j) == 1
% IDilated(i, j) = 0;
% end
IDilated = fill_function(IDilated, i, j, interval);
end
end
figure, imshow(IDilated);

end

function new_image = fill_function(Image, start_row, start_col, interval)

if Image(start_row, start_col) == 1 && Image(start_row, start_col + interval + 1) == 1
for i = 1:interval
Image(start_row, start_col + i) = 1;
end
end
new_image = Image;


end


[/code]

But I need to changed the code as follows .
The image index will be shifted forward by maxInterval. Then pixel will be examined backward. If the end pixel is found, an intensity value (C) will be added to every pixel back to the start pixel. When the operation moves to next pixel, the same procedure will be repeated. This way intensity will be built up as the process advance. Therefore the height of the edge is used as a factor of distance to shift the index. The height value will be multiplied by 2.5. That imply, the distance to the next character in the same line is expected to be found within
Sign In or Register to comment.