Log in or register to post comments

Region Capture

June 22, 2015 - 4:36pm #387
Developers often ask - how to extract the marker from video, how to make an application to be able to paint on the model.. and so on.
– I made a simple script that cut out the region of the marker from the video-background and eliminates perspective distortion.
So you get a rectangular image of marker from any angle.
 
All scripts are packed into the unitypackage.
AttachmentSize
Binary Data bytes

Region Capture

June 22, 2015 - 7:39pm #386

Thank you very much about your code !
I followed your guide, but it just wrap everything which camera watched to "Region_Capture" material. Should i finish step 5 before i can get just image target in camera image ? and you sad that use Scale, Position, and Rotation, these modifies attack to texture of material ?

Region Capture

June 23, 2015 - 1:14am #385

What is the size of your ImageTarget?

Region Capture

June 23, 2015 - 11:22pm #384

512 x 512 pixel

Region Capture

June 23, 2015 - 11:35pm #383

I mean - the scale values of the ImageTarget.

Region Capture

June 23, 2015 - 11:59pm #382

256 for the image target scale.

Region Capture

June 24, 2015 - 10:28am #381

OK. 

Set your "region_capture" prefab size is 256 / 10 = 25.6

Region Capture

June 24, 2015 - 10:44am #380

how are you doing the calculation for it ?

Region Capture

June 24, 2015 - 11:38am #379

For scale size? .. 

I just know the aspect ratio of my prefab to ImageTarget.  (1/10)

 

Region Capture

June 24, 2015 - 6:05pm #378

oh, I see, what we want to do now is change the position, rotation of "region_capture" reference to the position of "Image Target" ?

Region Capture

June 26, 2015 - 10:20am #377

ok i'm just a complete newbie to this, so ths question may sound very trivial.

 

I want to obtain the image as Texture2d and i can't figure out how to go about it.

Some guidlines as to how to go about it

Region Capture

June 28, 2015 - 11:42am #376

I have read your request and I added some new elements in the code.

– RenderTexture draw in GUI   --- ("Show Texture" checkbox)

– Auto Position and Scale  ---  ("Auto Region Size" checkbox)

– Update help information --- (new ReadMe.txt)

 

Click here – Setup image

AttachmentSize
Package icon region_capture_1.3.zip10.09 KB

Region Capture

June 29, 2015 - 7:52am #375

Great !! it's exactly what i want to do. Thank you very much!

Region Capture

July 4, 2015 - 2:18pm #374

So i'm working with unity 4.6

 

and when i import the region capture project, i'm unable to use the region_capture prefab for some reason.

do you have any idea why this might be an issue.

 

I tried to work your code in unity 5.0 it worked fine

Region Capture

July 5, 2015 - 12:44pm #373

Why do you use an older Unity version?

Region Capture

July 6, 2015 - 1:27am #372

I was getting some weird probelms with the unity 5.0 version. When i build the android app, the app was laggy and crashed every now and then. With the older version i'm not having such issues, so i decided to use the older version.

I tried to create the region capture prefab my self, but wasn't able to get the region capture perfectly. i think i might be having an issue with the shader script. The camera feed looks distorted on my region capture prefab. Any idea on how to go fix that. I seriously am out of ideas as to how to fix that

Region Capture

July 6, 2015 - 6:24am #371

Ok.. I added version for Unity 4X.

Now, all versions will be available on SourceForge.

Region Capture

July 12, 2015 - 3:34pm #370

Thanks for great asset! 
Can you explain how to save captured texture to file?

Region Capture

July 12, 2015 - 3:41pm #369

Thanks for great asset! 
Can you explain how to save captured texture to file?

 

GOtoApplyTexture - object that we paint on

 mainTextureAs2D- mainTexture from GOtoApplyTexture object

 TextureToSave   - public Texture2D  -  original mainTexture of GOtoApplyTexture object

 

 mainTextureAs2D = GOtoApplyTexture.GetComponent<Renderer>().material.mainTexture as Texture2D;
 mainTextureAs2D.Resize(TextureToSave.width, TextureToSave.width);
 
        for (int i = 0; i < TextureToSave.width; i++)
            for (int k = 0; k < TextureToSave.height; k++)
            {
                TextureToSave.SetPixel(i, k, mainTextureAs2D.GetPixel(i, k));
            }
TextureToSave.Apply();
 
 
in console i get error "NullReferenceException: Object reference not set to an instance of an object"  for this line:
mainTextureAs2D.Resize(TextureToSave.width, TextureToSave.width);
 
which means that unity can't get texture from this line:
mainTextureAs2D = GOtoApplyTexture.GetComponent<Renderer>().material.mainTexture as Texture2D;
 
 
 

Region Capture

July 19, 2015 - 2:16am #368

Thank you very much for your asset! I have spent weeks tying to do this. Would you consider to put this on GitHub or Bitbucket, so people can follow updates or other things like this? That would be very useful.

Region Capture

July 19, 2015 - 11:51am #367

Can someone help with saving GUI Texture to file? 

I can't get instance of material maintexture. Please help

Region Capture

July 22, 2015 - 7:19am #366

Thank you very very much !!!! It works perfectly fine. 

 

I want my app to be in Portrait mode, but when I choose that, it doesn't work anymore. And I can't find the things I have to switch/change, to make it work.

Can you help me ?

Region Capture

July 22, 2015 - 5:08pm #365

Hi Ihno.   I'll add it in a few days.

Region Capture

July 24, 2015 - 6:46am #364

Region Capture 1.4  

 

 

 

 

1. Portrait mode - added

2. LanscapeRight mode - bug fixed

3. Shift image in Editor - bug fixed

4. Incorrect capturing on Android devices with graphical navigation bar - bug fixed (hide bar on start application)

Region Capture

July 24, 2015 - 8:34am #363

Region Capture 1.4.1  (Small Fixes)

GitHub Link

Region Capture

July 27, 2015 - 2:06pm #362

Region Capture 1.5  (For Unity 5x only)

GitHub Link

 

 

 

Features:

Fast GPU Capturing

Auto Region size for non-square markers

Reduce color noise  (new)

Autofocus option  (new)

Hide Android navigation toolbar  (new)

 

PS:  Unity 4X is not supported more.

 

Region Capture

August 1, 2015 - 1:09am #361

Hi,

Is there going to be a update on Vuforia 5.0?

Region Capture

August 6, 2015 - 7:50am #360

so i used the asset and made an android app with unity, the asset seems to work fine on most phones, but sometimes fails to cature the target region on some tabs and phones, like the Mi tab, any idea as to why this could be happening

Region Capture

August 10, 2015 - 12:45pm #359

Region Capture 1.5.5  (For Unity 5x + Vuforia 5.0.5 only)

GitHub Link

 

 

 

Features:

Fast GPU Capturing

Auto Region size for non-square markers

FSM states "Marker is out of bounds" and "Marker is returned"  (new)

Reduce color noise

Autofocus option  (not worked on Galaxy Alpha)

Hide Android navigation toolbar

 

 

Please, make screenshots, if something is not working.

Region Capture

August 26, 2015 - 8:52am #358

Hi, guys!
How to save captured image to local file? Or to texture that will be the same at runtime after capture?

Region Capture

August 27, 2015 - 9:47am #357

Region Capture 1.6.0  (For Unity 5x + Vuforia 5.0.5 only)

GitHub Link

 

 

 

Features:

Fast GPU Capturing

Auto Region size for non-square markers

FSM states "Marker is out of bounds" and "Marker is returned"

Reduce color noise

Autofocus option

Hide Android navigation toolbar

Save capturing frame to localStorage as PNG  (new)

"Recalculate RegionSize" (method) if the marker has changed  (new)

"Recalculate TextureSize" (method) if the marker has changed  (new)

 

 

Please, make screenshots, if something is not working.

Region Capture

September 18, 2015 - 2:55pm #356

Small fix with MakeScreen() on Android. 

Many thanks to Afriyandi Setiawan

Region Capture

September 20, 2015 - 4:42am #355

Hi ,

 

So i was just playing around with the region cature asset, i made an android app, that just saves the picture of the image target on the Android Device using the makeScreen Function.

 

I Tested it out on a few devices, however i observed a few strange things, the saved image was a bit different on each device.

I tested it out on the Follwowing three devices 

OnePlus One , the image target was saved perfectly, 

Smasung S III, the image target was saved with the right width but the length was bigger

Xioami Mi Pad , the image length was right, but the width was bigger 

I used the Auto Calculate Region Size Feature, and then i set the region capture prefab size accroding to image target size, obtained the same results. 

 

I'm using unity 5.1.2f1 32 bit with Vuforis 5.0.5

 

I guess the script works fine with OnePlus, however doesn't really work with Samsung S III and the Mi Pad, Any ideas on what could be going wrong here 

 

I've added the saved images in a zip.

AttachmentSize
Package icon Apptest.zip982.69 KB

Region Capture

September 23, 2015 - 1:12am #354

Hi, Thanks for this great asset . I wanted to ask if Region Capture has a method or a way to know when the marker is completely in the view of the camera.

Thanks very much

Region Capture

September 23, 2015 - 5:56am #353
SomitPangtey, please send to me your Samsung S3 model number.
– Call *#1234# to show it.
 
User23, you can enable "Check Marker Position" checkbox, to get state (see console messages) if the marker is out of bounds.

Region Capture

September 23, 2015 - 2:33pm #352

I can't seem to get this to work at all.  It's just a grey image.  I'm using Unity 5.2 and Vurforia 5.0.5.  The image target is detected and tracked, but the region capture texture and gui preview texture are just grey. I followed the setup exactly.  But maybe I didn't fully understand what you mean when you say "Get Texture from 'Render_Texture_Camera' in PlayMode" on step 1.  Do you mean call a method to get the texture and set it to a material?  It looked like you were already doing that in Region_Capture.

Thanks.

Region Capture

September 24, 2015 - 4:15am #351

Hi madruse.

I guess this happened on the Mac OS X.  I will fix it in the next few days.
 
 
 
To make all worked fine on your Mac - find this line:  yield return new WaitForSeconds(0.5f); 
in  Region_Capture.cs  and change it to  1.0 or 1.5

Region Capture

September 24, 2015 - 10:21am #350

That was it! Thank you so much!

Region Capture

September 24, 2015 - 11:13am #349

hi,

 

So on calling *#1234#

it gives the following details

 

AP:I9300XWUGML4

CP:I9300DDUGNB1

CSC:I9300ODDGML4

 

 

Region Capture

September 29, 2015 - 9:57pm #348

App Start Black screen.. T..T

 

nexus5, nexus9 .. Symptom

 

Unity 5.1.3p1, Vuforia 5.0.5, RegionCapture 1.6.1 use..

 

Using Google Translator

Region Capture

September 30, 2015 - 2:46am #347

App Start.. Black Screen.. T..T

 

nexus5, nexus9 <<< Symptom

 

Unity 5.1.3p1

Vuforia SDK 5.0.5

RegionCapture 1.6.1

use

After building a cross-hyeoljeok a black screen is output during execution.

 

Using Google Translator

Region Capture

September 30, 2015 - 2:47am #346

App Start.. Black Screen.. T..T

 

nexus5, nexus9 <<< Symptom

 

Unity 5.1.3p1

Vuforia SDK 5.0.5

RegionCapture 1.6.1

use

After building a cross-hyeoljeok a black screen is output during execution..

 

Using Google Translator..

Region Capture

October 7, 2015 - 2:42am #345

Hi Maxim

 

I'm digging your asset for a while, nice one btw, my congrats! My problem is same to SomitPangtey 's I think. I'm trying to make an app and there is a problem on tablets. Actually problem is available most samsung phones but in tablets are way more horrible. Region automatically squeezing from sides and of course texture on model is drifting and distorting... Autosize region is marked but it seems doesn't work with some devices. My personal opinion is OIS cameras are working better than others. Is there any possible fix for that? I really need that to be working! Thanks in advance!

Region Capture

October 7, 2015 - 2:42am #344

Hi Maxim

 

I'm digging your asset for a while, nice one btw, my congrats! My problem is same to SomitPangtey 's I think. I'm trying to make an app and there is a problem on tablets. Actually problem is available most samsung phones but in tablets are way more horrible. Region automatically squeezing from sides and of course texture on model is drifting and distorting... Autosize region is marked but it seems doesn't work with some devices. My personal opinion is OIS cameras are working better than others. Is there any possible fix for that? I really need that to be working! Thanks in advance!

Region Capture

October 7, 2015 - 3:21am #343

Hi Wilk3ns!

- It's a big problem for me. I need much more devices for researching. ))

 

 

Region Capture

October 7, 2015 - 3:25am #342
Region Capture 1.6.5  (For Unity 5x + Vuforia 5.0.5 only)
Here are some fixes for Android devices.
Save to IOS gallery not working now. It will be fixed in next release.

Region Capture

October 7, 2015 - 3:44am #341

Hi Maxim

 

Thank you for rapid response, you can't even imagine how I'm happy for that)) Now, I have some iPad screens on description for you. Problem is same to Samsung tablets. I've tested new versionyou posted and didn't catch any differences. Can you note exactly what you have improved? And can I help you anyway? I'm very interested on this project))

AttachmentSize
Package icon screen.zip1.12 MB

Region Capture

October 7, 2015 - 4:22am #340

Same problem here... On Nexus 9 everything is OK, but on Samsung Galaxy S6, for example, capture region is bigger, than marker zone and moved to the bottom, so texture does not fit at all... I've tried to find a solution by myself, but no luck for now(( I guess, the problem is somewhere around  AR_Camera_Vector position and scale...

Today's version still have the same result :(

I can take part in finding a solution, or testing at least, if you want!

Region Capture

October 7, 2015 - 5:26am #339

The Capture Region size gets fixed by selsecting ar camera mode to be optimised speed in most devices.

I've tested it on a few Lenovo Phones, Mi4i, One plus one ,Samsung S6 and S3, Iphone 5 and 6, Ipad third Gen, and Ipad air 2, With the new region capture Script there hae been bugs  only with Samsung S3 and Ipad air 2. The Camera mode Set to optimise speed in my tests.

I got issues with samsug S3 and Ipad air 2. On the s3 the imafe was shifted upwards and on the ipad air 2 the image was shifted downwards, however the region size was ok

Region Capture

October 7, 2015 - 6:58am #338

SomitPangtey wrote:

The Capture Region size gets fixed by selsecting ar camera mode to be optimised speed in most devices.

Well... I've tried to switch mode to Optimize speed and Optimize Quality with no effect at all. On Galaxy S6 capturing is still far from expectations, nothing changes.

Adding

AR_Camera_Vector.transform.localPosition = new Vector3 (0.0f, 0.6f, 0.0f);

temporarily solves the problem for S6, but... =)

Region Capture

October 7, 2015 - 10:47am #337
The problem occurs when multi-threaded rendering is enabled in the settings.
Probably it's not the only problem. I will check it.
Log in or register to post comments