Friday, June 3, 2016

Next up: Trial and error.

So, there will be a process involved here, its not quite clear what that is yet, but would follow certain required work flow:

Scan Item
Clean item
Export Item
Import Item
Use Item


After performing an initial scan, I realized a couple things.
First, manually moving the kinect sensor around an object of relative large size is awkward.

The cables are long enough for my needs, but they do drag along the floor and can be a tripping hazard. Ideally, at some point, we'd setup a platform for scanning, and remove manual manipulation and error input ;).

Taking is slow and steady, I have a scan! Though, my scan is ugly, really ugly.

First thing I noticed was, in my garage..., the lighting condition isnt that well... This cuases defects and deformities in the 3d model.

Ill be making a trip to lowes and will  try to improve this tomorrow.

Second, my deformed model, not only picked up my object of interest, but it also picked up a lot of noise.

It's important to remove this extra data, which can bloat the 3d models quick!
The internet has suggested different 3d tools, currently I am looking at freely available options...

meshlab seemed promising in the past, but I suspect my current model has too much data, and it just cant handle my needs.

netflab free version is asking for a licence again, so I am not interested in messing with that...


I am actually considering writing a utility that can clean these models up... in fact, I most likely will later in the process, after this POC is further along.

But, for now, I actually found Autodesk's meshmixer somewhat helpfull.

It too freezes up a lot, but so far, if I am nice* to it, it has provided some pleasing results.

The plane splitting option is great.
Also, the mirror utility can prove to be helpful: http://www.meshmixer.com/download.html

Though, as we speak I just tried doing something,in fact I forget what I was doing, mostly becuase meshmixer has been frozen for a little while now...

Anyway, I also suggest looking into the hollow function, it seems? to be able to fill holes, which is a big problem with kinect data...


OH YEA, I was trying to fill holes... I think.









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!













Saturday, February 6, 2016

Lets do this! New Year New Month, go Broncos!

Wow, January flew by rightt??? That's ok, well as long as your not ok with that...

Why do say that, well because, each day is a gift, and we shouldn't let that gift fly by. For example, Super Bowl 50!, is this Sunday, for almost 2 weeks, since the Broncos played the Pats, I've been looking forward to this game, and wishing it was SuperBowl time already. Well, several times throughout the pass two weeks, I have cuaght myself and said hey, Thank God, today is Monday, Wednesday...FRIDAY!!!, etc.. Otherwise it would be a serious mistake to only LIVE once or twice a week?!(Fridays and\or Sunday?)

So today, make some goals, aim high, and joy all your blessings.

Speaking of starting a goal, this past several weeks, with the exception of the Super Bowl, getting back in shape, etc... I've been really interested in getting a personal project going. So the plan is to blog on updates on that project, which will be a form of documentation of the process, and common gotchas and don't dos that were no so common at first, second, or maybe even third glance.


Alright, after that tease?, the project itself will revolve around using the Microsoft Kinect Sensor, to grab 3d data of an object(s), given that data, format, decorate, and message it to a nice view able format. The end result is to take this new 3d object(with color), and place it in a 3d program for visual learning!!!(*Yeah I know its vague, but more on the main project at a later time).

My Kinect is a v2 sensor, with the adapter for my windows 10 laptop.

The first place to check out would be: https://msdn.microsoft.com/en-us/library/dn188670.aspx, to get a general overview of the fusion sdk, which currently does quite a bit, and has some nice examples of useage.

Next, when it comes to installing the kinect, I had driver issues, and I must warn you, that the kinect from what I can tell is picky on the hardware specs it will work with(saying that losely...) so do research and verify your computer hardware is compatible.

To actually, resolve my driver issues, I found this website:
http://www.windowscentral.com/xbox-kinect-windows-10, follow the directions on grabbing the latest development drivers from microsoft; once I grabbed the drivers, I disabled the registry key which allowed me to get them; call me paranoid...

Then, I found it straight forward to create a 3d model with color of my boxer, using the Fusion SDK Example: Fusion Explorer D2D. Specifically, it's important that when using this example, be sure to save your 3d model as a *.ply object, as this is the only format that seemed*(I say that with a lot of ignorance at the moment) to store color data*.

Afterwards, I was able to import my 3d model into a program like meshlab to view it!!!
Finally, once you import your model, you will most likely notice, it's not perfect, and what water proof???

WHen I say that, I mean, if you tossed, your 3d boxer model in your pool, it will sink to the bottom taking in water... this reminds me of the  time, my lab pushed my newly purchased boxer puppy into my clean pool, which later involved me jumping in the pool and showing her how not to swim...(we both went to the bottom and bobbled up to the top, both Daisy and I are doing fine now). Anyway, to combat this hole* issue, we need to replace these holes, and or fill them in.

There are tools out there like netfabb which can do this and are free. My first attempts and filling in the holes of my 3d model, didnt go so well, I apparently had a lot of holes, and the netfabb app ran out of memory. I also used the repiar option on the meshlab tool, and it just crashed the program, I suspect it's becuase my 3d model maybe high res enough, and very holey.

Aside from freeware, I'd really like to fix this from a script, or another program, perhaps via an api to a dll. So far I haven't found a library to do this. But, I found a good early Saturday read, or Friday night eye puller, which appears promising: https://graphics.stanford.edu/papers/holefill-3dpvt02/hole.pdf.

There is source available for this algorithm actually, but its compiled for linux. My goal is to compile it for windows 10 and go from there.

So, stay tuned, next post will involve issues and partial resolutions to compiling and getting glut working.

Go BRONCOS!






UPDATE: If you need to build glut for windows 10, grab the windows 7 sdk, and build from visual studio command line, you may have to add the windows 7 sdk include to the bat file:
set INCLUDE=%INCLUDE%;C:\Program Files\Microsoft SDKs\Windows\v7.0A\include;