Recortar una imagen JPGIntentando recortar el borde gris claro desde el exterior de la imagen del mapa de obleas a continuación usando el siguiente script. Supongo que no entiendo cómo funciona el mensaje de recorte ya que no hay diferencia en las imágenes de antes y después.
¿Alguna idea de lo que estoy haciendo mal?
Saludos, Troya
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);

secuencias de comandosRe: Recortar una imagen JPG@georg señaló a https://www.jmp.com/support/help/en/16.1/?os=win&source=application&utm_source=helpmenu&utm_medium=application#page/jmp/images.shtml
que parece idéntico al guía de secuencias de comandos . referencia de sintaxis.

Señalaría el índice de secuencias de comandos:

Ambos dicen "crea una nueva imagen", pero solo se modifica la imagen existente, lo cual fue parte de la confusión, y ninguno explica bien los parámetros. Hay otro cultivo, para un segmento, que es distinto de este.
¡Gracias por mirarlo!
Re: Recortar una imagen JPGGracias por traer esto a mi atención. ¿A qué documento se hace referencia en los comentarios anteriores?
Gracias,
Qiana
Re: Recortar una imagen JPGSí, es una interfaz no obvia y quiere una mejor documentación. @Anónimo
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.Los índices de píxeles basados en cero están en las líneas finas entre los píxeles.
Re: Recortar una imagen JPGQuerido @Thierry_S ,
Hubiera pensado de la misma manera, este comportamiento es extraño, como dice la documentación: "crea nueva imagen ...".
Pero, de hecho, recortar está cambiando la imagen actual, por lo que, en mi opinión, la documentación no es correcta, es engañosa.
@tonya_mauldin , ¿crees que la documentación tiene que ser modificada de acuerdo a esto?
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");Imágenes (jmp.com)
Re: Recortar una imagen JPGBuen trabajo. Las definiciones Derecha e Inferior que proporcionó no son exactamente como las especificó. ¡Tu guión es perfecto!
Vea el guión a continuación.
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=90Re: Recortar una imagen JPGBien, parece que no entendí cómo funciona la función de recorte. Básicamente, debe conocer la altura y el ancho de la imagen que está recortando y trabajar con esos valores cuando recorta, en relación con los bordes LHS y SUPERIOR.
Izquierda = Número de píxeles a eliminar del lado izquierdo
Derecha = 'Ancho' (en píxeles) de la imagen restante para mantener
Superior = Número de píxeles que se eliminarán de la parte superior de la imagen
Inferior = 'Altura' (en píxeles) de la imagen restante para mantener
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);
Re: Recortar una imagen JPGGracias por la respuesta Thierry.
Yo también había intentado exactamente eso, pero sin suerte.
Re: Recortar una imagen JPGHola,
Creo que olvidaste asignar la imagen recortada a una variable:
img2 = img << crop(left(5),right(5),top(5),bottom(5));
win2 = newWindow("Cropped", img2);
Mejor,
TS
Re: Recortar una imagen JPGGracias @Craige_Hales
muy (!) útil