Ask Your Question

Revision history [back]

Transparency (alpha) handling in cascade training?

Since I was not getting good recognition results (on aerial photography of cattle on fields), I tried to use transparency in the positives, to let the cows stand out more. Ultimately, I want to count the cows on the image.

But using transparency is a dumb idea, it seems, and I would just like to confirm that

  • transparency in the positive images is ignored by the createsamples and traincascade tools
  • only the -bgcolor and -bgthresh of createsamples determine what is considered transparent

Is that correct?

The problem I see is that the background of the positive cow images vary a lot (gras vs. sand, gras texture, etc.), so I will have an issue specifying a single -bgcolor. Before I set out to mask the background, I'd like to know how to do it correctly.

Thanks, nobi

Transparency (alpha) handling in cascade training?

Since I was not getting good recognition results (on aerial photography of cattle on fields), I tried to use transparency in the positives, to let the cows stand out more. Ultimately, I want to count the cows on the image.

But using transparency is a dumb idea, it seems, and I would just like to confirm that

  • transparency in the positive images is ignored by the createsamples and traincascade tools
  • only the -bgcolor and -bgthresh of createsamples determine what is considered transparent

Is that correct?

The problem I see is that the background of the positive cow images vary a lot (gras vs. sand, gras texture, etc.), so I will have an issue specifying a single -bgcolor. Before I set out to mask the background, I'd like to know how to do it correctly.

Thanks, nobi

EDIT: Here are samples of the images I use:

Overview of field, from which cows (and calves) should be counted (cropped): image description

Positive image, extracted from one of the overview images: image description

Resulting sample file (since .vec cannot be uploaded, this is a screenshot of a .vec file): image description

The sample file is not one created from the positive image - because opencv_createsamples renames the files, I cannot easily find the corresponding one.

What you can clearly see in the sample file is the background of the positive, which could lead to the (very) low recognition rate (actually, zero).