- What is the 3rd dimension of the image? Is your array actually a stack of images. Your figures only show a 2D image.
- The gaps to be filled are the vertical black lines or the horizontal band in the middle, or something else?
- To identify your edge, can we assume that the middle band is always in the centre of the image and always the same width? Do you know the actual width?
- giving us an actual image instead of a figure would help
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
2D / 3D Interpolation (Linear or Spline ) for image - Matlab
3 ビュー (過去 30 日間)
古いコメントを表示
Alina tom
2018 年 5 月 5 日
Hi all
I have a image (Given Below) it is a 3d image have size 512x271x512 . I want to apply interpolation on the missing part.

I want to apply interpolation on that image to fill the gap and after it I have to calculate the edge points of the image like this
and want to get the edge of the surface like shown in output image

can anyone please guide me . how I can do this . Thanks in advance for your help
13 件のコメント
Guillaume
2018 年 5 月 15 日
編集済み: Guillaume
2018 年 5 月 15 日
Alina tom
2018 年 5 月 15 日
編集済み: Guillaume
2018 年 5 月 15 日
Yes this a stack of images . actually my image is in circular from and I have converted the image to its sagittal view . here is my code for converting the image
my actual image consist of 271 frames
Img = uint8(zeros(512,512,271)); % preallocate 4-D array
for frame=1:271
[Img(:,:,frame),map] = imread('image.tif',frame);
end
sno = size(Img); % image size
sno_a = sno(3); % number of axial slices
S_a = round(sno_a/2);
sno_s = sno(2); % number of sagittal slices
S_s = round(sno_s/2);
sno_c = sno(1); % number of coronal slices
S_c = round(sno_c/2);
S = S_a;
sno = sno_a
ImgSg = flip(permute(Img, [1 3 2]),2); % Sagittal view
S = S_s;
sno = sno_s;
imshow(squeeze(Img1(:,:,S,:)));
by gap mean vertical black lines . that are filled by the information of continuous edge .
The middle band is always in the center of image and its width is between this value 225:286,1:271,:
actual image can be downloaded from this link
Guillaume
2018 年 5 月 15 日
Your code is a bit confusing, there's a lot of variables you create that are not used. More importantly, it's not clear what the Img1 you pass to imshow is. It looks like you've unrolled each frame but it's not what the code you posted does.
Alina tom
2018 年 5 月 15 日
I have created these variables to get different view like to get XZ view and YZ view . In imshow I'm using the slice column from where I have to cut the image . here I have attached the output of this code before and after removing the middle part. now I want to fill the gap and after filling the gap I want to get the edge information smoothing like this



Alina tom
2018 年 5 月 15 日
I have converted the image into binary and then cut the image from middle into upper and lower part and try to find the 1st non zero element and then fill the previous part with white pixels . but its not working . can you please see my code where I'm doing wrong
if true
Kmedian = imgaussfilt(Img1,[1 1]);
[counts,x] = imhist(Kmedian,16);
T = otsuthresh(counts);
BW = imbinarize(Img1,T);
[rows, columns, numberOfColorChannels] = size(BW);
middleRow = floor(rows/2);
topHalf = BW(1:middleRow, :,:);
bottomHalf = BW(1+middleRow:end, :,:);
filterImg = bwareaopen(bottomHalf,25);
output_img = zeros(size(bottomHalf));
for col = 1: size(bottomHalf,2)
first_nnz_row = find(filterImg(:,col),1,'first');
output_img(first_nnz_row:end,col) = 1;
end
figure, imshow(squeeze(output_img(:,:,S,:)));
filterImg = bwareaopen(topHalf,25);
output_img1 = zeros(size(topHalf));
for col = 1: size(topHalf,2)
first_nnz_row1 = find(filterImg(:,col),1,'last');
output_img1(1:first_nnz_row1,col) = 1;
end
figure, imshow(squeeze(output_img1(:,:,S,:)));
end
Guillaume
2018 年 5 月 15 日
Can you attach, as a mat file, not a screenshot of a figure, the actual Img1 that you use to test your code? As it is, it is difficult to understand what each step is doing.
Note that since BW is a binary image, hence 2D, numberOfColorChannels is unneeded in:
[rows, columns, numberOfColorChannels] = size(BW);
This is simpler:
[rows, columns] = size(BW);
Also, you create a 2D output_img and fill it in a loop. Therefore,
imshow(squeeze(output_img(:,:,S,:)))
is just
imshow(output_img)
if S == 1, and an error otherwise.
Alina tom
2018 年 5 月 16 日
https://drive.google.com/open?id=1p6_JsehMsoxz-spTxA84f08AjVwideCC This is the link For Img1 in mat formate
Alina tom
2018 年 5 月 16 日
How I can read the pixels along the curve structure like in image and draw a line on it like in this picture and also want to fill the gaps along the curve . can you guide me

Guillaume
2018 年 5 月 17 日
This is the link For Img1 in mat formate
If I load that mat file and then do
imshow(Img1(:, :, 1)) %or using any other index for the 3rd dimension
I get nothing that resembles your image at all.
Alina tom
2018 年 5 月 17 日
Sir can you guide me how I fuse/ combine two images . one image is 2d having dimensions 512x271 and other image is 3d having dimensions 512x271x512. I want to combine them to make one image . the output image have size 512x271x512
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Read, Write, and Modify Image についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)