Re: Camera preview orientation on HTC-Universal



Gary, thx for the prompt response.

Gary Daniels [MS] wrote:
When you set the format on the preview pin, are you creating your own media type to set or retrieving one from the driver and just tweaking it to what you want?

I use the standard media types:

	// create the complete graph
	hr = m_pCaptureGraphBuilder->RenderStream(
		&PIN_CATEGORY_PREVIEW,
		&MEDIATYPE_Video,
		m_pVideoCaptureFilter, pBFilter, NULL );

Even with pBFilter (which is a filter derived from CTransInPlaceFilter and therefore naturally should not change the media-type) replaced by NULL, the image gets rotated and flipped.

Btw, the caps show that the pin is not capable of h- or v-flipping. Camera roll is supposedly supported (yeah, I can roll the device ;-) ) but (as expected) does not have any effect.

A special flag was developed (BI_SRCPREROTATE) which tells GDI and the video renderer that the orientation of the image from the camera is in the correct orientation (don't rotate when rendering it). This is necessary because as you rotate the shell on the device you also physically rotate the device. When the display driver rotates bitmaps to render the shell and UI it needs to know that this particular bitmap shouldn't be rotated. The flag is or'd into the biCompression field in the BITMAPINFO structure.

I will play around with this, at least it should therefore be possible to use the same transform for both screen rotations. Even if this would probably mean that I have to implement a more complex (non-in-place) filter, right?


I suspect you created your own format structure from scratch and did not set this flag, resulting in GDI rotating your preview along with the physical rotation of the device.

Not that I am aware of. If you want I can send you the relevant source (copyright blablabla...).


Thx a lot,
Andres

Gary Daniels
Windows CE Multimedia and Graphics

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.

"cputoaster" <cputoaster@xxxxxxxxxxxxx> wrote in message news:%23%23ykxPz$FHA.1600@xxxxxxxxxxxxxxxxxxxxxxx

Hi,

after I actually got the capture and filter to work, I am having a strange problem. The input from the camera gets displayed "flipped over the diagonal", meaning it is rotated by 90 degrees and then flipped horizontally. And this changes depending on screen rotation. While I can rotate the image manually by writing a filter (I already did), it is certainly the wrong way and will cut off 1/4 of the image (if I do it per in-place-filter).

How can I tell the output renderer to NOT rotate / flip the content? The original video recording app can do it correctly, so there must be some flags on that camera or output renderer to set. I did already try the documented flip and roll attributes, without luck.

Andres



.



Relevant Pages

  • Re: Camera preview orientation on HTC-Universal
    ... It sounds to me like you're seeing a camera ... does not use DirectShow or the DirectShow camera driver. ... This is necessary because as you rotate the shell on the device you also physically rotate the device. ... How can I tell the output renderer to NOT rotate / flip the content? ...
    (microsoft.public.pocketpc.developer)
  • Re: Camera preview orientation on HTC-Universal
    ... A special flag was developed which tells GDI and the video ... you rotate the shell on the device you also physically rotate the device. ... When the display driver rotates bitmaps to render the shell and UI it needs ... > How can I tell the output renderer to NOT rotate / flip the content? ...
    (microsoft.public.pocketpc.developer)
  • RE: Light Direction relative to World Matrix
    ... It's usual practice to move the camera and derive the view matrix transform ... I can then rotate the world matrix to rotate my camera. ... I use a Tilt field to change the Z-component of my LookAt vector, ... This means that when I rotate the camera, the shadows on the ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: Light Direction relative to World Matrix
    ... > from the camera position, ... I can then rotate the world matrix to rotate my camera. ... I use a Tilt field to change the Z-component of my LookAt vector, ... >>Microsoft MVP ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: Camera preview orientation on HTC-Universal
    ... Rendering the preview pin as you did below should always result in the image ... It sounds to me like you're seeing a camera ... does not use DirectShow or the DirectShow camera driver. ... >> the correct orientation (don't rotate when rendering it). ...
    (microsoft.public.pocketpc.developer)