AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

FilterGraytoGray

The forum is to discuss topics related to different areas of image processing and computer vision.

FilterGraytoGray

Postby ismail_ahmet » Sun Jan 29, 2017 9:43 pm

Hello;
I try watershed image segmentation code, but program failed.
how can i fixed this errors?
Code: Select all
Severity   Code   Description   Project   File   Line   Suppression State
Error   CS0246   The type or namespace name 'FilterGrayToGray' could not be found (are you missing a using directive or an assembly reference?)   Segmentation   C:\Users\İsmail\Documents\Visual Studio 2015\Projects\Segmentation\Segmentation\WatershedPixel.cs   70   Active


Code: Select all
Severity   Code   Description   Project   File   Line   Suppression State
Error   CS0115   'WatershedGrayscale.ProcessFilter(BitmapData)': no suitable method found to override   Segmentation   C:\Users\İsmail\Documents\Visual Studio 2015\Projects\Segmentation\Segmentation\WatershedPixel.cs   365   Active

thank you.
ismail_ahmet
 
Posts: 12
Joined: Sat Dec 03, 2016 12:45 pm

Re: FilterGraytoGray

Postby ismail_ahmet » Sun Jan 29, 2017 9:49 pm

Code: Select all
protected override void ProcessFilter(BitmapData imageData)

Code: Select all
public class WatershedGrayscale : FilterGrayToGray

i take errors this codes.
ismail_ahmet
 
Posts: 12
Joined: Sat Dec 03, 2016 12:45 pm

Re: FilterGraytoGray

Postby andrew.kirillov » Mon Jan 30, 2017 8:23 am

Hello,

FilterGrayToGray is not part of AForge.NET Framework. Same as Watershed.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3453
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: FilterGraytoGray

Postby andrew.kirillov » Mon Jan 30, 2017 8:27 am

Actually FilterGrayToGray was in the framework long time ago, but was removed. Here is its old version.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3453
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: FilterGraytoGray

Postby ismail_ahmet » Mon Jan 30, 2017 3:33 pm

andrew.kirillov wrote:Actually FilterGrayToGray was in the framework long time ago, but was removed. Here is its old version.


Code: Select all
Bitmap bmp = new Bitmap(pictureBox1.Image);
            WatershedGrayscale b = new WatershedGrayscale(8);
            // Lock the bitmap's bits.
            Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
            System.Drawing.Imaging.BitmapData bmpData =bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite,bmp.PixelFormat);
            b.Apply(bmpData);
            bmp.UnlockBits(bmpData);

            pictureBox2.Image = (System.Drawing.Image)bmp;

I add references this version aForge.imaging. this is right version but I created a WatershedGrayscale object and used its Apply method with a BitmapData. But there was an error: "The filter can be applied to graysclae (8bpp indexed) image only". How to solve this
how can i convert ?
ismail_ahmet
 
Posts: 12
Joined: Sat Dec 03, 2016 12:45 pm

Re: FilterGraytoGray

Postby andrew.kirillov » Tue Jan 31, 2017 8:11 am

ismail_ahmet wrote:But there was an error: "The filter can be applied to graysclae (8bpp indexed) image only". How to solve this

Make your image grayscale. Don't need to feed 24 bpp images.

ismail_ahmet wrote:how can i convert ?

Check documentation. There is Grayscale filter.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3453
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: FilterGraytoGray

Postby ismail_ahmet » Tue Jan 31, 2017 7:35 pm

andrew.kirillov wrote:
ismail_ahmet wrote:But there was an error: "The filter can be applied to graysclae (8bpp indexed) image only". How to solve this

Make your image grayscale. Don't need to feed 24 bpp images.

ismail_ahmet wrote:how can i convert ?

Check documentation. There is Grayscale filter.

I read but this version older. Code isn't same convert gray.
ismail_ahmet
 
Posts: 12
Joined: Sat Dec 03, 2016 12:45 pm

Re: FilterGraytoGray

Postby ismail_ahmet » Tue Jan 31, 2017 9:52 pm

andrew.kirillov wrote:
ismail_ahmet wrote:But there was an error: "The filter can be applied to graysclae (8bpp indexed) image only". How to solve this

Make your image grayscale. Don't need to feed 24 bpp images.

ismail_ahmet wrote:how can i convert ?

Check documentation. There is Grayscale filter.



Code: Select all
if (imageData.PixelFormat != PixelFormat.Format8bppIndexed)
                throw new ArgumentException("The filter can be applied to graysclae (8bpp indexed) image only");

just one picture sent me please. this code suitable. I try a lot of picture and convert code but i don't find suitable picture.
ismail_ahmet
 
Posts: 12
Joined: Sat Dec 03, 2016 12:45 pm

Re: FilterGraytoGray

Postby andrew.kirillov » Wed Feb 01, 2017 10:57 am

ismail_ahmet wrote:I try a lot of picture and convert code but i don't find suitable picture.

You don't need to search for suitable picture. All you need is to use Grayscale class, which converts color image to gray. I mentioned about docs.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3453
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: FilterGraytoGray

Postby ismail_ahmet » Fri Feb 03, 2017 10:02 am

andrew.kirillov wrote:
ismail_ahmet wrote:I try a lot of picture and convert code but i don't find suitable picture.

You don't need to search for suitable picture. All you need is to use Grayscale class, which converts color image to gray. I mentioned about docs.

I was make this. But now i need to object counter (blob counter ). label1.text=number of object how can i do?
ismail_ahmet
 
Posts: 12
Joined: Sat Dec 03, 2016 12:45 pm




Return to Image Processing and Computer Vision

cron