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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.