이미지를 원통 또는 구 모양으로 매핑하시겠습니까? (Mapping image into cylinder or sphere shape?)


문제 설명

이미지를 원통 또는 구 모양으로 매핑하시겠습니까? (Mapping image into cylinder or sphere shape?)

So lets say I have black & white image that is read with imread() command and saved into matrix A.

I want to output/graph this matrix A image in a cylinder shape. I know how to draw a cylinder in MATLAB, but I do not have a clue what I should do if I want to put image on a cylinder or draw image in cylinder shape. Any help will be appreciated. Thank you.

I found this site from googling. http://www.flashandmath.com/advanced/rolls/cylin.html This is exactly what I want to do, but I need to do this in MATLAB.


참조 솔루션

방법 1:

The technique is called texture mapping. This is a code example from surface function (R2011b):

load clown
surface(peaks,flipud(X),...
   'FaceColor','texturemap',...
   'EdgeColor','none',...
   'CDataMapping','direct')
colormap(map)
view(‑35,45)

This example loads RGB image from "peppers.png" and maps it onto cylinder:

imgRGB = imread('peppers.png');
[imgInd,map] = rgb2ind(imgRGB,256);
[imgIndRows,imgIndCols] = size(imgInd);
[X,Y,Z] = cylinder(imgIndRows,imgIndCols);
surface(X,Y,Z,flipud(imgInd),...
    'FaceColor','texturemap',...
    'EdgeColor','none',...
    'CDataMapping','direct')
colormap(map)
view(‑35,45)

Things are even simpler with the warp function (comes with Image Processing toolbox) as natan suggested:

imgRGB = imread('peppers.png');
[imgRows,imgCols,imgPlanes] = size(imgRGB);
[X,Y,Z] = cylinder(imgRows,imgCols);
warp(X,Y,Z,imgRGB);

(by J Lanandr)

참조 문서

  1. Mapping image into cylinder or sphere shape? (CC BY‑SA 3.0/4.0)

#image #image-processing #matlab






관련 질문

이미지가 추가될 때 div 높이가 과도하게 늘어남 (div height overstretching when image is appended)

MS-Outlook 임베디드 이미지를 가져오고 MS-Access VBA를 사용하여 파일 시스템에 저장 (Getting MS-Outlook embedded images and saving them within the file system using MS-Access VBA)

Android 이미지 갤러리 이미지 자르기 및 ImageView 설정 (Android Image Gallery Crop Image and set ImageView)

Facebook은 드래그하여 이미지를 닫는 데 어떤 라이브러리를 사용합니까? (What library does Facebook use for dismiss image by dragging?)

이미지를 Picturebox(VB6의 이미지)에서 문자열(Base64)로 변환하는 방법은 무엇입니까? (How to convert Image from a Picturebox(Image in VB6) to String(Base64)?)

HTML, Canvas 및 WebGL 간의 품질 차이 (Quality differences between HTML, Canvas and WebGL)

TBitmapImage는 Inno Setup 6에서 크기 조정된 디스플레이의 크기보다 크게 렌더링됩니다. (TBitmapImage is rendered larger than its size on scaled display in Inno Setup 6)

이미지 URL이 실제 이미지를 가리키는지 확인합니다. 문제를 일으키는 URL의 공백 (Check if an image URL points to an actual image. Space in URL in causing issue)

android studio에서 인텐트를 통해 여러 콘텐츠를 보내는 방법 (how can i send multiple contents through intent in android studio)

Squarespace 사이트용 CSS로 이미지의 위치를 완벽하게 제어 (Fully Control The Location of an Image with CSS for Squarespace site)

iText7을 사용하여 PDFButtonFormField에 이미지를 추가할 때 종횡비를 유지하는 방법 (How to Maintain Aspect Ratio when Adding an Image to a PDFButtonFormField using iText7)

png 이미지에서 픽셀 색상 추출 (extracting pixel color from png image)







코멘트