stright line in one column or raw

조회 수: 1 (최근 30일)
majed majed
majed majed 2015년 3월 14일
편집: majed majed 2015년 3월 30일
could any one help me ?
if i have a line as figure shown with pexils which does not exixt in one line (raw or column ) how can i make this line completely stright ? what code i hav to write ?

채택된 답변

Image Analyst
Image Analyst 2015년 3월 14일
Just get the coordinates
[rows, columns] = find(grayImage < 128);
Then find the max and min:
row1 = min(rows);
row2 = max(rows);
% Find average column
meanColumn = int32(mean(columns));
Then draw the line
grayImage(row1:row2, meanColumn) = 0;
  댓글 수: 4
Image Analyst
Image Analyst 2015년 3월 15일
What "cells"? Do you mean pixels? And what does "delete" mean to you, keeping in mind that an image must remain rectangular. Do you just want to replace them (not delete them) with white pixels? Then why not just draw the line on a completely new white image
whiteImage = 255 * ones(rows, columns, 'uint8');
whiteImage(row1:row2, meanColumn) = 0;
majed majed
majed majed 2015년 3월 30일
편집: majed majed 2015년 3월 30일
yeah , i mean to replace not to delete cells ,thanks a lot.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by