Friday, June 3, 2016

Good day ladies and gentlemen.

So, after being away for the early part of the year, I am back and ready to tackle this project and any issues that may arise.. one at  a time.

Alright, so after starting up any of the sample apps that require displaying a picture to screen using directx2d(c++) I ran into the issue of not seeing my sensor data(image).

Ok, my first thought was that, my wife put a virus on the computer, from all the Asian web sites she visits ;).

But no, maybe, we will move on from that... Next I tried reinstalling the sdk and drivers from microsoft for the kinect.
Then, I reran, from the sdk browser, the samples, noticing, only the wpf samples showed me images...


After more tinkering, I realized the sensor was actually grabbing data from the c++ samples, the problem, was that, it just wasn't drawing* to screen; I Determined this via, one of the sample apps that allow you to take a screen shot. So, since my  screen shots, looked fined, I moved on and focused on the directx2d code within the c++ samples.

What I found was enlightening...


So, browsing msdn, I found sample directx code. Using that as a template, I started plugging in initialization parameters...
One such parameter was the size input:
            hr = m_pD2DFactory->CreateHwndRenderTarget(
            rtProps,
            D2D1::HwndRenderTargetProperties(m_hWnd, size/*D2D1::SizeU(
rc.right - rc.left,
rc.bottom - rc.top)*/),
            &m_pRenderTarget

Above, you can see that the second parameter for HwndRenderTargetProperties, takes in a size. This size was being maxed to the screen resolution.

So, out of curiosity, I then replaced this size with a customized value of:

                RECT rc;
GetClientRect(m_hWnd, &rc);


Using this commented out code above**, this actually passed in a different size to the app.
This size, smaller, was actually the size of the app window. Though being smaller, it worked!
Well kinda, with this window size I was able to see a percentage of the sensor data, so not my full view; I saw my full view, when I took a screen shot, using the sample app, or using the graphics debugger from within visual studio, and grabbing a frame; therefore my kinect sensor had more data available.

Knowing this, I started to think would cause this??? Well, looking into the size parameter more, I noticed its related to the size in pixels. And when you consider pixels, you need to consider the screen dpi.

Then I started googling, how to check windows desktop dpi...

When I did this, I found that at some point, in between last using the kinect(3 months ago???) I must have changed my dpi...

See this page on how to change back: http://www.tenforums.com/tutorials/5990-dpi-scaling-level-displays-change-windows-10-a.html

So in short, if your having issues, where your sensor is grabbing good data, but directx will not draw that data, it could be related to your dpi setting.

Personally, I had mine set to 130 %, after changing back 100%, and logging out and back in, this resolved my data resolution issue.


COOL, so now I have to determine if I can improve performance, increase data collection, offline processing? and prevent api exceptions; api returned a result: 0x80004005


Until next time, have fun!













No comments:

Post a Comment