Image map coordinates with javascript variables - imagemap

Is there a way to have the coordinates of an image map be equal to percentage values or variables defined in JavaScript? I am trying to have the image map coordinates adjust sizes when the image size changes with the screen size.

Related

How to convert a RGB image to a two dimensional image in Matlab

I have a RGB image called imrgb, the size of which is 320*512*3.
I want to know how to convert it to a two dimensional image?
I saw some colorful images, but they are still two dimensional instead
of three dimensional. Can anyone tell me how to convert it to a
two-dimensional image but still looks colorful?
If I understood right you can store the image data as a 2D array and use a colormap to assign it colors, displaying it as a "colorful" image. In this case the colormap will be a Nx3 array where each row corresponds to an index present (or not) in the image data. So if the colormap is a 256x3 array, for example, the image will be made of indices ranging from 0 to 255.
For example, let's consider the peppers.png demo image that ships with Matlab. Let's read and use the rgb2ind function to store the image data in variable X and its associated colormap in variable map.
a = imread('peppers.png');
[X,map] = rgb2ind(a,256);
If we ask the size of X, we get:
ans =
384 512
So a 2D variable, even though the original image (a) was 3D (rgb).
If we wish to display this 2D data as a colorful we need to provide a suitable colormap. For instance, we can use the original colormap (stored in map) in order to get the following:
image(X)
colormap(map)
axis off
or we can use any other colormap of our choice.
For example:
image(X)
colormap(jet(200)) %// The size can be different than the original colormap
axis off
yielding:
So as you see the image looks 3D but the data is actually 2D.
Is this what you meant?

How to get the value of intensity map,color map,orientation map of an image in MATLAB?

I am trying to get the unique values of any object in imae processing , such as its color map value, intensity and orientation in matlab, i got the saliency map for the objects but i couldn't extract the above Values from the saliency map , can you give any tips on how to find it ?
To calculate mean intensity for the whole image . we can convert the input rgb img to grayscale, then third line will give the intensity value input_rgbimg=imread('imagefilename.jpg');Inimg=rgb2gray(input_rgbimg);
intensity_img=mean2(Inimg); it will be in floating point format..

View pixel intensities of an image

How to view the pixel intensities of an image in matlab by moving the mouse pointer over the image?
I used:
imshow(imread('image.jpg'));
But there is no option to view the pixel intensities of each pixel in the image.
For example,
In MS-paint, while moving the mouse pointer
over the image we can see the location of
the pixel such as (20, 117) at the status bar.
But I need to see the pixel intensity instead.
Is there any other option to view it. Or I need to code to view it?
One other option which is more interactive is
imtool(imread('image.jpg')); % For GrayScale Image
imtool(rgb2gray(imread('image.jpg'))); % For RGB Image
If you want to create an intensity map, you can use MATLAB's rgb2gray. This will convert the n-by-m-by-3 RGB array you got from imread to an n-by-m matrix which contains the pixel intensities.
You can then point the interactive data cursor to this intensity matrix for the current mouse coordinates.
you have impixelinfo and impixelinfoval for showing interactive information.

Image map re-sizing

I have been looking to dynamically scale a image map with coordinates to a div, so when re-sizing a window occurs the map and all coordinates are scaled accordingly.
any suggestions on how to do this?
i think this may work
http://blog.outsharked.com/p/image-map-resizer.html
but with the alternate option of :enter a bounding area and the map will be clipped to within that area.
my question then is how do i establish a bounding area, will it scale dynamically to that whole area?
This jQuery plugin works great for scaling and rescaling image maps on the fly. You can call this once, and it will take care of all image maps on the page. It will even rescale an image map if something happens that changes an image's dimensions.
https://github.com/stowball/jQuery-rwdImageMaps.
If you weren't just using the div to solve the image map scaling problem, you could put a blank image (a completely transparent .gif or .png) in your div with the image map applied to it and set its width and height to 100%.

Take x% from an image

I was wondering for a good and easy way to get for example 5% of pixels of an Image (bitmap image) randomly and save them in another bitmap image or in array or whatever.
Is there such a way in C# or I should try to loop through the image and randomly select 5% of the data in an array[][].
Anyway I did it by my own method. I looped through the pixels of the image with randomly generated x and y coordinates and I selected x% of the all number of pixels from the original image. These pixels I copied to another bitmap image.

Resources