Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, October 20, 2015 6:24:55 AM(UTC)

JustinF  
Guest

Groups: Guests
Posts: 3,049

Was thanked: 1 time(s) in 1 post(s)

The attached project demonstrates how to utilize RasterImage.GetPixelColor along with a basic Nearest Neighbor Search implementation to find the nearest pixel of a given color to the cursor.

https://www.leadtools.com/help/leadtools/v19/dh/l/leadtools~leadtools.rasterimage~getpixelcolor.html

https://en.wikipedia.org/wiki/Nearest_neighbor_search

Right click on any pixel to select a color. Then, double click anywhere on the image to snap the cursor to the nearest pixel of the selected color.

NOTE: The search algorithm is greedy. It will snap to the first-found nearest neighbor of the selected color, even if equidistant neighbors of the selected color exist.
File Attachment(s):
NearestPixelWinForms.zip (20kb) downloaded 47 time(s).
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2017, Yet Another Forum.NET
This page was generated in 0.130 seconds.