裁剪 JPG 圖像嘗試使用以下腳本從下面的晶圓圖圖像外部裁剪淺灰色邊框。 我想我不明白裁剪消息是如何工作的,因為前後圖像沒有區別。
知道我做錯了什麼嗎?
乾杯,特洛伊
img = open("D:\wafer.jpg", jpg);
win1 = newWindow("Original", img);
img << crop(left(5),right(5),top(5),bottom(5));
win2 = newWindow("Cropped", img);
img << savePicture("D:\waferCropped.jpg", jpg);

腳本回复:裁剪 JPG 圖像@Georg指向https://www.jmp.com/support/help/en/16.1/?os=win&source=application&utm_source=helpmenu&utm_medium=application#page/jmp/images.shtml
看起來與腳本指南.語法參考。

我會指向腳本索引:

兩者都說“創建一個新圖像”,但只修改了現有圖像,這是混亂的一部分,也沒有很好地解釋參數。 對於一個細分市場,還有另一種作物與這一作物不同。
感謝您的關注!
回复:裁剪 JPG 圖像感謝您引起我的注意。 以前的評論中引用了什麼文件?
謝謝,
錢娜
回复:裁剪 JPG 圖像是的,它是一個不明顯的界面,需要更好的文檔。 @匿名的
pixels = [
-11 -11 -11 -11 -11 -11 -11 -11 -11,
-11 -11 -91 -99 -99 -99 -99 -92 -11,
-11 -11 -99 -99 -99 -99 -99 -99 -11,
-11 -11 -99 -99 -99 -99 -99 -99 -11,
-11 -11 -99 -99 -99 -99 -99 -99 -11,
-11 -11 -93 -99 -99 -99 -99 -94 -11];
img = New Image( pixels );
{hSize, ySize} = img << size;
Show( img << getsize, img << getpixels );
// crop the -11 out of the image
img << crop( Left( 2 ), Right( 8 ), top( 1 ), bottom( 6 ) );
Show( img << getsize, img << getpixels );
//// img << getsize = {6, 5};
//// img << getpixels =
//// [ -91 -99 -99 -99 -99 -92,
//// -99 -99 -99 -99 -99 -99,
//// -99 -99 -99 -99 -99 -99,
//// -99 -99 -99 -99 -99 -99,
//// -93 -99 -99 -99 -99 -94];
The zero-based pixel indexes are on the hairlines between the pixels.The zero-based pixel indexes are on the hairlines between the pixels.The zero-based pixel indexes are on the hairlines between the pixels.The zero-based pixel indexes are on the hairlines between the pixels.The zero-based pixel indexes are on the hairlines between the pixels.從零開始的像素索引位於像素之間的細線上。
回复:裁剪 JPG 圖像親愛的@蒂埃里_S ,
我會以同樣的方式思考,這種行為很奇怪,正如文檔所說:“創建新圖像......”。
但實際上裁剪正在改變當前圖像,所以在我看來,文檔不正確,具有誤導性。
@tonya_mauldin ,您認為必鬚根據此更改文檔嗎?
Names Default To Here( 1 );
img = Open( "$SAMPLE_IMAGES/tile.jpg", jpg );
Print( "Size before crop:", img << get size );
img << Crop(
Left( 50 ),
Right( 400 ),
Top( 50 ),
Bottom( 400 )
);
Print( "Size before crop:", img << get size );
print("So crop changes the image and does not create a new one as written in the documentation");圖片 (jmp.com)
回复:裁剪 JPG 圖像不錯的工作。 您提供的 Right 和 Bottom 定義與您指定的不完全相同。 你的劇本是正確的!
請參閱下面的腳本。
Names Default To Here( 1 );
img = Open( "$SAMPLE_IMAGES/tile.jpg", jpg );
s = {w,h} = img << get size();
show( s ); //{451, 451}
obj = New Window( "tile(40,40)", img );
Wait( 1 );
img << Crop( Left( 50 ), Right( 100 ), Top( 60 ), Bottom( 150 ) );
s = {w,h} = img << get size();
show( s ); //{50, 90}
//img is a matrix of pixels the initail size is 1 to 451 columns aka "w" width
//and "h" is height 1 to 451 rows
//Crop Left(x) is the starting column and Right(y) is the ending column
//Top() and Bottom() works the same, so after the crop the width is 100-50=50
//and the height is 150-60=90回复:裁剪 JPG 圖像好的,所以看起來我只是不明白裁剪功能是如何工作的。 從根本上說,您需要知道要裁剪的圖像的高度和寬度,並在裁剪時使用這些值,相對於 LHS 和 TOP Edges
Left = 要從左側移除的像素數
右 = 要保留的剩餘圖像的“寬度”(以像素為單位)
頂部 = 從圖像頂部移除的像素數
底部 = 要保留的剩餘圖像的“高度”(以像素為單位)
img = open("D:\WaferMaps\8PTPCVEB\wafer.jpg", jpg);
imgX = (img << GetSize)[1];
imgY = (img << GetSize)[2];
win1 = newWindow("Original", img);
myTrimBy = 5;
img << crop(left(myTrimBy),right(imgX - myTrimBy), top(myTrimBy), bottom(imgY - myTrimBy));
win2 = newWindow("Cropped", img);
img << savePicture("D:\WaferMaps\8PTPCVEB\waferCropped.jpg", jpg);
回复:裁剪 JPG 圖像感謝蒂埃里的回复。
我也曾嘗試過,但沒有運氣。
回复:裁剪 JPG 圖像你好,
我認為您忘記將裁剪後的圖像分配給變量:
img2 = img << crop(left(5),right(5),top(5),bottom(5));
win2 = newWindow("Cropped", img2);
最好的,
TS
回覆:裁剪 JPG 影像感謝@Craige_Hales
非常有幫助!