public ProcessImage ( |
||
image | Source image data to process. | |
return | List |
public List<IntPoint> ProcessImage(Bitmap image)
{
// check image format
if (
(image.PixelFormat != PixelFormat.Format8bppIndexed) &&
(image.PixelFormat != PixelFormat.Format24bppRgb) &&
(image.PixelFormat != PixelFormat.Format32bppRgb) &&
(image.PixelFormat != PixelFormat.Format32bppArgb)
)
{
throw new UnsupportedImageFormatException("Unsupported pixel format of the source");
}
// lock source image
BitmapData imageData = image.LockBits(
new Rectangle(0, 0, image.Width, image.Height),
ImageLockMode.ReadOnly, image.PixelFormat);
List<IntPoint> corners;
try
{
// process the image
corners = ProcessImage(new UnmanagedImage(imageData));
}
finally
{
// unlock image
image.UnlockBits(imageData);
}
return corners;
}
HarrisCornersDetector::ProcessImage ( |
|
HarrisCornersDetector::ProcessImage ( |
private void BtnHarris_OnClick(object sender, RoutedEventArgs e) { // Step 1: Detect feature points using Harris Corners Detector HarrisCornersDetector harris = new HarrisCornersDetector(0.04f, 1000f); harrisPoints1 = harris.ProcessImage(img1).ToArray(); harrisPoints2 = harris.ProcessImage(img2).ToArray(); // Show the marked points in the original images Bitmap img1mark = new PointsMarker(harrisPoints1).Apply(img1); Bitmap img2mark = new PointsMarker(harrisPoints2).Apply(img2); // Concatenate the two images together in a single image (just to show on screen) Concatenate concatenate = new Concatenate(img1mark); PictureBox.Source = concatenate.Apply(img2mark); }