How may I change certain areas of a geometry (specified by point point) with reference to a geometry?

1 view (last 30 days)
I have two pointclouds containing x,y,z cordinates of two similar geometry. Say A and B. A is suppose a square of size 1mm by 1mm. B is also a square of size 0.5mm by 0.5mm. However, in B one edge is distorted (see attached figure). Now I wish to correct it, which means, change it to sqaure of size 0.5mm by 0.5mm. Is there a way to do it?

Accepted Answer

yanqi liu
yanqi liu on 5 Jan 2022
clc; clear all; close all;
[X,map,alpha] = imread('https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/852940/Picture1.png');
figure; imshow(alpha);
bw = im2bw(alpha);
bw = bwareaopen(imfill(bw, 'holes'), 1000);
bw2 = bwareafilt(bw, 2);
bw(bw2) = 0;
[r,c] = find(bw);
bw(min(r):max(r),min(c):max(c)) = 1;
bw = logical(bw);
be = imdilate(bwperim(bw), strel('disk', 3));
alpha(be) = 255;
figure; imshow(be);
figure; imshow(alpha);
  13 Comments
Ajay Goyal
Ajay Goyal on 7 Jan 2022
Thank you very much my friend. It will solve the purpose. I am home quarantined since yesterday and will try to study it on Monday, if report is in my favor :). Take care Regards, Dr. Ajay
yanqi liu
yanqi liu on 8 Jan 2022
it is my pleasure,in thie question,we use the loop iteration for compute,and choose the best result. of course,may be use some parameter to adjust

Sign in to comment.

More Answers (0)

Categories

Find more on Fixed-Point Conversion in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!