ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 AfterAcquireBitmap error
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

graphman

259 Posts

Posted - Jan 18 2013 :  17:19:30  Show Profile  Reply
At this event I see
ImageEnMIO->Params[0]->SamplesPerPixel = 3
and
ImageEnMIO->Params[0]->BitsPerSample = 8

for ALL images 1bit, 8bit and 24 bit

How to fix it?

w2m

USA
1990 Posts

Posted - Jan 19 2013 :  06:53:32  Show Profile  Reply
Your code only handles the first image and it only sets the IO.Params. To fix this use the index to set the IO.Params and also use ConvertTo24Bit:

procedure TForm1.ImageEnMIO1AfterAcquireBitmap(Sender: TObject; index: Integer);
begin
  ImageEnMIO1.Params[index].SamplesPerPixel := 3;
  ImageEnMIO1.Params[index].BitsPerSample := 8;
  ImageEnProc1.ConvertTo24Bit;
end;

William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

graphman

259 Posts

Posted - Jan 19 2013 :  09:24:36  Show Profile  Reply
I need to get Black@White image, but I see only
ImageEnMIO->Params[0]->SamplesPerPixel = 3
and
ImageEnMIO->Params[0]->BitsPerSample = 8

At this event for black images I se parameters like color images.
Go to Top of Page

graphman

259 Posts

Posted - Jan 19 2013 :  09:29:32  Show Profile  Reply
At this event I copy image to ImageEnView and I want to get correct color parameters, but I see parameters like for 24 bit image.

ImageEnMIO->Params[index]->SamplesPerPixel = 3
ImageEnMIO->Params[index]->BitsPerSample = 8

always !!!
Go to Top of Page

fab

1310 Posts

Posted - Jan 22 2013 :  10:47:16  Show Profile  Reply
It is strange SamplesPerPixel and BitsPerSample are set when the image is loaded. So if they are 8:3 it means the image is loaded/acquired as RGB, not black/white.
Please note that if you change the bitmap pixelformat manually the parameters SamplesPerPixel and BitsPerSample must be changed also.
Go to Top of Page

graphman

259 Posts

Posted - Jan 22 2013 :  15:58:04  Show Profile  Reply
I scan black-and-white image and see SamplesPerPixel and BitsPerSample = 8:3
instead of 8:1

Why?
How to fix?
I need to get these parameters only (AfterAcquireBitmap event)
Go to Top of Page

fab

1310 Posts

Posted - Jan 25 2013 :  00:16:46  Show Profile  Reply
Unfortunately SamplesPerPixel and BitsPerSample properties are set just after AfterAcquireBitmap returns.
For this reason you may set these parameters manually, example:

procedure TForm1.ImageEnMView1MIOOnAfterAcquireBitmap(Sender:TObject; index:integer);
begin
  case ImageEnMView1.ImageBitCount[index] of
    1:
      begin
        ImageEnMView1.MIO.Params[index].BitsPerSample := 1;
        ImageEnMView1.MIO.Params[index].SamplesPerPixel := 1;
      end;
    24:
      begin
        ImageEnMView1.MIO.Params[index].BitsPerSample := 8;
        ImageEnMView1.MIO.Params[index].SamplesPerPixel := 3;
      end;
  end;
end;
Go to Top of Page

graphman

259 Posts

Posted - Jan 29 2013 :  11:24:34  Show Profile  Reply
thanks
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: