15,923,120 members
See more:
Hi friends,
I have coordinates of image such as X1,Y1,X2 and Y2. I want to highlight image part based upon its coordinates. I googled it but I am not able to find solutions. Please help me.....
Posted
Updated 22-Jul-13 0:56am
v2
Herman<T>.Instance 22-Jul-13 6:24am
Please share code. We cannot see what you have tried more.
Samresh.ss 22-Jul-13 6:38am
What do you mean by highlight. Do you mean a zoomed in effect
enhzflep 22-Jul-13 7:15am
Just draw a polyLine from each of the points to the next.
You may wish to fill a polygon with a semi-transparent colour before drawing the polyline.

Here's how I do it in javascript. A quick tour of MSDN will tell you the names of the (roughly) equivalent functions in c#.

// takes a string that contains coords eg - "227,307,261,309, 339,354, 328,371, 240,331"
// draws a line from each co-ord pair to the next - assumes starting point needs to be repeated as ending point.
function drawPoly(coOrdStr)
{
var mCoords = coOrdStr.split(',');
var i, n;
n = mCoords.length;

//c.fillStyle="#aaaaaa"
hdc.fillStyle = "rgba(255,0,0,0.3)";

hdc.beginPath();
hdc.moveTo(mCoords[0], mCoords[1]);
for (i=2; i<n; i+=2)
{
hdc.lineTo(mCoords[i], mCoords[i+1]);
}
hdc.lineTo(mCoords[0], mCoords[1]);
hdc.stroke();
hdc.fill();
}

Solution 1

The standard way to highlight selections in MS GUIs is to invert the colors. So what you do is get access to the image bitmap data (Work with bitmaps faster in C#[^]) and 1-complement the desired pixels.

Alternatively, you can think of increasing the luminance by multiplying all three color components by a common factor (say `1.33`), but you will need to limit the factor to avoid saturation, that could induce a color drift. So in practice, use `Min(1.33, 255. / Red, 255. / Green, 255. / Blue)`. For this reason, luminance enhancement will not work on already light areas.

Solution 2

Hi friends, thanks all for the suggestions. I found another solutions that link is....

http://odyniec.net/projects/imgareaselect/examples.html[^]

v2
Naz_Firdouse 23-Jul-13 8:37am
updated the url with anchor tag instead of plain text

Solution 3

You can use cropperjs library. In that library there is method called "setCropBoxData(data)" you can set your co-ordinates and a cropper-box will be build on top of that co-ordinates. There are multiple options to change as your use case , I worked previously on that library.
Hope this helps.
https://www.npmjs.com/package/cropperjs

v2
OriginalGriff 3-Apr-24 1:34am
While I applaud your urge to help people, it's a good idea to stick to new questions, rather than 11 year old ones. After that amount of time, it's unlikely that the original poster is at all interested in the problem any more!
Answering old questions can be seen as rep-point hunting, which is a form of site abuse. The more trigger happy amongst us will start the process of banning you from the site if you aren't careful. Stick to new questions and you'll be fine.