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
 TImageEnProc.DoPreviews changes not applied
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

cbiasatti

Argentina
4 Posts

Posted - Nov 08 2016 :  13:18:14  Show Profile  Reply
Hi, I'm capturing video using a TImageEnView called img1, then overrided its DShowNewFrame as this:

procedure TdlgCaptura.img1DShowNewFrame(Sender: TObject);
begin
  // copy current sample to ImageEnView bitmap
  img1.IO.DShowParams.GetSample(img1.IEBitmap);

  // refresh ImageEnView1
  img1.Update;
end;


This displays the currently selected video source.

Now, I want to change RGB or HSL offsets. To do that I call img1.Proc.DoPreviews(), but when I close the preview window by clicking Ok the changed values are not applied to the image. How can I do what I want?.

Currently my code looks like this:

if img1.Proc.DoPreviews([peAll]) then
begin
  img1.IO.Update;
end;


Regards,
Claudio.

xequte

39052 Posts

Posted - Nov 09 2016 :  03:35:10  Show Profile  Reply
Hi Claudio

Previews and image effects only apply to the image that is currently loaded. As soon as you call "img1.IO.DShowParams.GetSample(img1.IEBitmap);" it replaces the current image (IEBitmap) with a new one from DShowParams.GetSample.

You would need to apply the effect after each "img1.IO.DShowParams.GetSample(img1.IEBitmap);" call, but that would probably have too adverse an effect to performance.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

cbiasatti

Argentina
4 Posts

Posted - Nov 09 2016 :  06:56:17  Show Profile  Reply
Hi Nigel, thanks for your answer.

What I need is a way to setup some RGB/HSL and Brightness/Contrast
values for the video source, nothing more than that. How can I do that?.

Claudio.
Go to Top of Page

xequte

39052 Posts

Posted - Nov 11 2016 :  16:02:31  Show Profile  Reply
Hi

If you display the Previews dialog, then you can use ImageEnView1.Proc.IPDialogParams to see what settings the user applied.

http://www.imageen.com/help/TImageEnProc.IPDialogParams.html

You can then apply the effects yourself, e.g.

procedure TdlgCaptura.img1DShowNewFrame(Sender: TObject);
begin
  // copy current sample to ImageEnView bitmap
  img1.IO.DShowParams.GetSample(img1.IEBitmap);

  with img1.Proc.IPDialogParams do
    img1.Proc.HSLvar( HSL_H, HSL_S, HSL_L ); 

  // Note: Don't need to refresh if used img1.Proc
  // img1.Update;
end;


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

cbiasatti

Argentina
4 Posts

Posted - Nov 14 2016 :  13:08:27  Show Profile  Reply
Hi xequte, I think I'm getting closer. Now I'm changing Channels using this:

ImageEnView1.IEBitmap.ChannelOffset[0] := tbRed.position;
ImageEnView1.IEBitmap.ChannelOffset[1] := tbGreen.position;
ImageEnView1.IEBitmap.ChannelOffset[2] := tbBlue.position;
ImageEnView1.Update;


This updates the video preview in real time.

Now I want to create a thumbnail of the current frame. To do this I do:

x := ImageEnMView1.AppendImage;
ImageEnMView1.SetImage(x, ImageEnView1.Backbuffer);


This creates a thumbnail of ImageEnView1, BUT using the viewing size (stretched) and not the real captured size of the video.

If I change that code to this:

x := ImageEnMView1.AppendImage;
ImageEnMView1.SetIEBitmap(x, ImageEnView1.IEBitmap);

The stored thumbnail has the correct size, but does't preserve the channeloffsets.

Is there a way to copy the image without stretching it and also preserving the channel offsets?.
Go to Top of Page

xequte

39052 Posts

Posted - Nov 14 2016 :  14:58:25  Show Profile  Reply
Hi

You can use IEBitmap.FixChannelOffset(); to permanently apply your ChannelOffsets. Of course, if you do it ImageEnView1.IEBitmap then they will be applied to the displayed image (until the next frame is loaded via DShowParams.GetSample), so you may want to do it to a copy.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

cbiasatti

Argentina
4 Posts

Posted - Nov 17 2016 :  10:43:47  Show Profile  Reply
Hi xequte,

Your suggest worked fine!
Thanks !


Code:


procedure TdlgCaptura.Capture;
var
  x : Integer;
begin
  x:= ImageEnMView1.AppendImage;

  ImageEnMView1.SetIEBitmapEx(x, img1.IEBitmap);

  ImageEnMView1.GetTIEBitmap(x).ChannelOffset[0]:= img1.IEBitmap.ChannelOffset[0];
  ImageEnMView1.GetTIEBitmap(x).ChannelOffset[1]:= img1.IEBitmap.ChannelOffset[1];
  ImageEnMView1.GetTIEBitmap(x).ChannelOffset[2]:= img1.IEBitmap.ChannelOffset[2];
  ImageEnMView1.GetTIEBitmap(x).Contrast:= img1.IEBitmap.Contrast;

  ImageEnMView1.GetTIEBitmap(x).FixChannelOffset;

  ImageEnMView1.GetTIEBitmap(x).FixContrast;

  ImageEnMView1.Update;

end;
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: