Scale an SVG object along a user-defined axis in Illustrator - scaling

I have an object (see orange arc below) within an SVG that I would like to scale along the axis of the object itself.
I know the "Transform" options in Illustrator allow you to scale along the X or Y axis, but that doesn't work for me. I want to scale the object such that at each cross-section of the arc (depicted as the black lines in the photo), the object is exactly 10% of the width of the original. Therefore, the axis that I want to scale along is the hypothetical curved line which passes perpendicularly through all of the black lines in the photo.
If done correctly, this should reduce the X and Y dimensions of the object only slightly, but will reduce the orange-colored area to be 10% of the original.

Related

How to modify the scale of x and y axes of image pixel plot object from spatstat package in R

I have this image pixel object, created using Spatstat package in R. The range of x-axis is [0,24], the range of y-axis is [28000, 29500]. When I plot it out in R studio, the graph looks very narrow as below:
I guess it is because the range of x-axis is too small compared to y's. What should I do to make the plot wider?
In the spatstat package, spatial objects are always plotted isometrically. The plot uses the same physical scale for the x and y axes.
Spatial objects in spatstat occupy a specific location and size in two-dimensional space. A pixel image (object of class "im") is associated with a rectangular region at a specific location in two-dimensional space with a specific width and height. If this region is long and thin, then the plotted image will be displayed as long and thin, and will not be rescaled to fit the screen or page.
If you want to stretch a pixel image in spatstat, you need to transform it to another image, which will be defined on a different region of two-dimensional space.
You can do that with the spatstat function affine. In your example, if Z is your original pixel image, you could do
A <- affine(Z, diag(c(60,1)))
The second argument is the transformation matrix, which in this case is just a stretch of the x axis by a factor of 60. (The transformation will stretch the domain of the image, and stretch each individual pixel, by a factor of 60 in the x direction. The number of pixels and the pixel values will be unchanged. No interpolation or other fudging will occur.)
See Chapters 3 and 4 in the spatstat book

2-D alpha map examples for blending two overlayed images in MATLAB

I would like to blend two images, one is smaller and is completely enclosed by the larger one, Assume the both are rectangular. I would like to blend these two so that there is a smooth transition in a rectangular band around the smaller image. I am trying to do this in MATLAB.
For example here two images are shown on top of each other, orange and black mages:
I would like to create a transition band around the orange image such that at the very outward boundaries of the band the alpha map for the orange image has a value of 0 and for very inward boundaries have value of 1 and there is a smooth transition from 0 to one inside the gray band that is shown below:
I am looking for a map for the gray area probably a 2-D matrix that has values between 0 and 1. Is there any equation based or ready made such matrix?
I know I can create a simple linear transition for a vertical or horizontal band for example if the X shows the x-coordinate of the left most edge of the inner image and my blending width is W then I can use this:
alpha(x) = (x-X)/W for X<x<X+W
1 for x > X+W
But how to create such an alpha in 2-D?

Extract pixel coordinates in scilab

I have extracted edge using image processing then I selected pixel coordinate using xclick of extracted edge.Is this correct or there is need of reverse y axis coordinate?(Extracted edge is white on black background)
I want to automatically extracted pixel coordinates of extracted edge not by mouse selection.Is there is any command available in scilab?(I use canny edge detector and morphological filter to extract edge)
Please give me some suggestions
Thanks
1.) Whether to reverse the y coordinte or not, depends on the further processing. Any coordinate system can be used if you need only relative measurements and the true orientation of your features is not important (e.g. reversing top and bottom makes no difference if you simply want to count objects or droplets). Hovewer if you want to indicate your found features by plotting a dot, or a line, or a rectangle (e.g. with plot2d or xrect) or a number (e.g. with xnumb) over the image, then it's necessary to match the two coordinate sytems. I recommend this second option and to plot your result over the original image, since this is the easiest way to check your results.
2.) Automatic coordinate extraction can be made by the find function: it returns those indices of the matrix, where the expression is true.
IM=[0,0,0,1;0,0,0,1;0,1,1,1;1,1,0,0]; //edge image, edge = 1, background = 0
disp(IM,"Edge image");
[row,col]=find(IM==1); //row & column indices where IM = 1 (= edge)
disp([row',col'],"Egde coordinates (row, col)");
If your "Egde image" marks the edges not with 1 (or 255, pure white pixel) but with a relatively high number (bright pixel), then you can modify the logical expression of the find function to detect pixels with a value above a certain threshold:
[row,col]=find(IM>0.8); //if edges > a certain threshold, e.g. 0.8
EDIT: For your specific image:
Try the following code:
imagefile="d:\Attila\PROJECTS\Scilab\Stackoverflow\MORPHOLOGICAL_FILTERING.jpg";
//you have to modify this path!
I=imread(imagefile);
IM=imcrop(I,[170,100,950,370]); //discard the thick white border of the image
scf(0); clf(0);
ShowImage(IM,'cropped image');
threshold=100; //try different values between 0-255 (black - white)
[row,col]=find(IM>threshold);
imheight=size(IM,"r"); //image height
row=imheight-row+1; //reverse y axes coordinates (0 is at top)
plot2d(col,row,style=0); //plot over the image (zoom to see the dots)
scf(1); clf(1); //plot separate graph
plot2d(col,row,style=0);
If you play with the threshold parameter, you will see how the darker or whiter pixels are found.

MayaVi: Label axes with "wrong" scale

Can I have a different scale on my axes than in my plot?
I'm displaying an image in mayavi, and then graphing some 3D shapes around it. All my measurements are related to the size of the image (ie in pixels) so that things are in the right relative positions.
But the image is of the Milky Way, and I want to label the axes in distance units (kpc) instead of pixels. Basically, I need to label the axes in pixels and then divide all the values by 20 to get kpc. Is that possible?
Thanks!

IDL: Can I get the coordinates of a point on my plot's cartesian plane?

I have a plot like this:
http://i.imgur.com/i9xp5.png
I need the data coordinates of points in order to plot wind barbs.
Now, if I wanted a wind barb to be drawn at x=100, y=20, is there a way I can obtain the data coordinates of that ( or other ) points of my plot?
Would the ARROW procedure be of any use to you? It looks like you could
just pass it your data coordinates (x0=100, y0=20) for the base of the arrow,
and another set of coordinates x1 and y1 representing the length and direction for the arrowhead end. It should take care of placing and scaling them properly on your plot.
But I don't think ARROW gives you any control over the arrow style, except for color,
heaviness of the lines, and filled vs. unfilled. If you need to use a different
shape, I think you might have to express it as an array of XY points to define
the vertices of your custom arrow symbol, then rotate, scale, translate, and PLOTS
line segments between each symbol vertex.
The DATA and DEVICE graphics keywords tell the various plotting routines whether
the coordinates are in data coordinates or device coordinates. I'm not sure from
your description which is the appropriate setting, but one of them should do what you want.

Resources