Extract Depth/Distance Coordinates from Huawei P9 - Huawei P9 Questions & Answers

Hi All,
I had a previous post entitled "Extracting Both Images from P9 Dual Camera": http://forum.xda-developers.com/p9/help/extracting-images-p9-dual-camera-t3465877. The help I received was excellent and so I thought I'd expand on the question.
I am successfully able to produce a "Bokeh" image from the P9, which would seem to indicate that this image does have depth coordinates embedded in it at least at one point in time. Does anyone know how to extract these depth coordinates from the image in a usable form, such as a matrix? I know one user (ScareIT) suggested Huawei may use steganography to embed the depth coordinates, but after using iSteg (a Mac steganography platform) it does not appear that the image has any hidden coordinates once it is transferred from the mobile device to the desktop.
As always, any help would be highly appreciated.
Best,
Josh

As I wrote on the other thread, the depth information is not hidden anywhere, it's just appended to the end of the file, after all valid JPEG data chunks. The JPEG image actually contains two; one is the processed image with the "bokeh" effect, the other is the original (colour) image that is used to re-apply the "bokeh" effect when editing from the Gallery app. If you take an app like JPEGSnoop and walk through the valid JPEG data chunks, you'll notice that the file is actually larger than what JPEGSnoop shows you. Look at the file in a Hex editor at that offset, and you'll see that the depth information is stored with reduced resolution and 8 bits per pixel, but without any compression whatsoever. This part of the file also contains additional information, such as the selected "aperture", the point of focus, which effect (if any) is applied to the out-of-focus areas, and so on. It should be fairly easy to write an application that can extract this additional information, though it's probably not very useful.

Related

[INFO] Solved Internet Globe w/o XML Editing

Procedure To Edit The Internet Globe Button Manila Files
(No more solid white blank buttons)
7d3f1247_manila - Globe Unselected
3f00cd2f_manila - Globe Selected
What:
With this procedure you will be able to select any graphics or highlight color you want to use for both the selected and non selected states of the Internet globe button.
How:
There are no special tools required other than Manila Editor 0.2 and a graphics program that can work with png files. You will need to know how to use both of these programs though.
Advantages:
The biggest advantage over editing either 27c65cbd_manila or InternetPortal-en-US.xml would have to be speed. When I tried that way on my Fuze it would take well over 5 seconds to load every time I scrolled to the Internet tab. Sometimes almost double that on a fresh boot. Second advantage would be that this *should* work on any device that uses those 2 files, where the xml edits are different files for different devices. Which leads to the third advantage of not needing special install instructions for theme makers. Edit the manilas and drop them in with the rest.
Other Info:
(Just skip this part if you don't care about the why and scroll down to the instructions.)
I have literally scoured these forums and the Internet for days trying to find information on editing not only the Internet globe manila files, but the other 7+ files that just don't work right with Manila Editor. Most theme makers know of these files. Mostly what I found was a lack of information and more questions than answers. The only other procedure I could find at all for converting manila files gives better results than using Manila Editor but it's very complex for the average user requiring command line tools. Even so the author, (Chainfire) has written a damn near fool proof tutorial so if anyone is interested you can find the thread HERE. Unfortunately even that procedure would not handle the problem manila files properly and quits with the following message.
Reading file: 5c01b59c_manila
Error: file is not QTC format
For reference, this is the list of files that I know of at the moment with this problem, and all return the same error except for 7d3f1247_manila. (More on this file to come.)
7d3f1247_manila - Globe_Unselected (512x256) 28.5k
3f00cd2f_manila - Globe_Selected_D (512x256) 64.5k
40ec2415_manila - Small Avatar_D (64x64) 2.5k
2f411611_manila - Exclamation Point_D (256x256) 32.5k
4d97cac6_manila - Add Contact_D (256x256) 32.5k
54e0759d_manila - Contact Avatar_D (256x256) 32.5k
400b663e_manila - You Tube_D (64x64) 2.5k
55cc771a_manila - Selection Highlight Bar (512x256)64.5k
5c01b59c_manila - Contact Avatar2_D (256x256) 32.5k
The first oddity I noticed when using Manila Editor on the Globe file (3f00cd2f_manila) is no mater what size my graphic was before running it through, it always came out to be approximately 125k. Since the stock file was roughly half that size I knew something was really wrong. The other glaring anomly with most of the files is they show up as duplicated (side by side) images when viewed with M.E. so I figured that somehow all of this must be connected.
I am not a programmer by any stretch but I know just enough to get me into trouble most of the time. Anyway I loaded both files into Notepad++ and turned on hex view to see what was so different. The header of both files were similar but not exactly the same so I copied chunks of the problem file from below its header and pasted it into the good manila at the same address location. What it produced was a repeating pattern on the top left corner of the stock green button but every other row was white. I don't know why but the fact that the image repeats in M.E. as well and the file being double the size made me think to cut the image in half and try to see if M.E. would accept it. It did and I was elated to finally see an image on my phone other than than the big white rectangle.
I had an image that was really distorted but it wasn't difficult at this point to see what was going on by the way it was distorted. I was able to get a perfect button on my next try by creating my image on a 256x128 canvas and then scaling it to 512x128. It looks really bad and stretched out at this point but after processing with M.E., the phone will compress back to it's original aspect and it looks just perfect. I use The Gimp as my image editor and just save as a png file with the default settings.
Now that I Finally had a working selected globe image I wanted to change the static globe as well. (7d3f1247_manila) This was a whole new battle but at least I had something to work from this time. There are some significant differences in this file compared to the selected globe. First, it looks perfect when you extract it using M.E. which led me to believe that this would be easy. I couldn't find much info on this particular manila and I think I know the reason why. Either people are replacing both images via the xml workaround, or they are just concerned with getting the highlight the right color on the selected image. Either way, when I tried to do a 1:1 replace in M.E I got to see the wonderful white rectangle again. At this point I had finally gotten all the tools working from the post I mentioned before and decided to try this file using that procedure as it should return better results if it did work. It worked perfectly but I still wanted to get it to work using M.E as most people are not going bother with a long drawn out procedure.
After playing around some I found that if I scaled the 512x256 image to 256x256 it worked perfectly. The up side is the file size is half of the stock image. The down side is the resolution is obviously cut in half. It's really not a show stopper but using the other method does produce perfect results. Not completely satisfied yet I tried some more images at different resolutions to see what happened. The 480x240 image I had from one of the globe mods that are floating around produced a white rectangle. I then decided to try another unscaled image that was almost completely transparent and it worked without a hitch. Now that I was completely confused I went back and tried the original 512x256 that produced the white and it did so again. It wasn't until I switched to another tab and back again that it finally showed up correctly.
So what does it all mean? Hell if I know but at least the scaled 256x256 method seems to work every time without any problems and its fast to boot. The long procedure would be the best method of them all but probably not worth the effort for most. As far as the other problem files go I guess I'll try and work them out too unless someone else more capable picks up the ball and runs with it. The selected globe was the particular image that stuck in my craw and got me started on this.
Instructions for 3f00cd2f_manila - Globe Selected:
1. Create your image at a size of 256 x 128 exactly how you want it to look on your device.
2. Scale it to a size of 512 x 128 and save it. You will have to "unlock" the aspect ratio lock in most graphics programs. This will distort your image badly but do not fret. Yet.
3. Fire up Manila Editor as usual and use your new image. Now you can fret as you wait to see if this works or not.
4. <-- I hope
Instructions for 7d3f1247_manila - Globe Unselected:
1. Create your image at a size of 512 x 256 exactly how you want it to look on your device.
2. Scale it to a size of 256 x 256 and save it. You will have to "unlock" the aspect ratio lock in most graphics programs.
3. Fire up Manila Editor as usual and use your new image.
General Notes:
If you don't want to mess with any of this and like what's in the screen-shots attached, you can install the cab or just unpack the zip into your windows directory on your device. As always, please back up your files before adding new software.
Notes concerning 7d3f1247_manila:
This procedure *should* work if done as stated. If you use the alternate method I linked to in the info section above you don't have to scale the image and will get a higher resolution image. I have successfully used a non scaled image before with Manila Editor but it goes white on first load after a reboot then somehow clears up. With the scaling method I've yet to see the dreaded white rectangle. Read the info section for more information.
More Information:
Manila Editor 0.2.0
Editing Manila
Manila 3D Porting
Pixel Perfect TF3D ***
Manila Fine Details
Cheers,
Eidolen
*Disclaimer*:
Obviously I can't test this on every device but I can't think of any reason why this wouldn't work on any TF3D enabled device. If this doesn't work for you, feel free to post here or contact your congressman. (Where applicable) If this helps anyone please be sure to drop in and say hi.
There is some real development going on about this subject over on the pixel perfect thread. If you are just looking for a quick fix then what I posted above is still relevant but you might want to keep an eye out for a *real* fix as I doubt it will take them long once they sink their teeth into it.
I believe they already figured out that you can patch the header on the problem files to correct the payload size which should work also. If you are not so technically inclined then the method posted here still works flawlessly for me and should for you as well.
I've added a picture that might help if the directions above were confusing at all, so it might help clear it up. You can find the link to the Pixel Perfect thread right above this post.
Cheers,
Eidolen

[REQ] MS Paint / Image resize for Raphael

I'm sure others have come across this...
My carrier's limit on sending MMS is ~300KB. Our 3.2mp pictures are much larger. That and most people I want to send MMS's to don't have a 300 by whatever + resolution screen on their phone.....
So I'm looking for a simple, easy to use, app that will just resize images for me. I know the MMS software in most ROM's will auto-convert them to some sizes, but I'd rather just save the images at that size to begin with... and send that smaller file myself (also good for uploading to ftp servers to share via e-mail to other mobile devices)
I did some browsing, and i saw maybe some versions of HTC Album do resizes... but I'm not really looking to update that yet... most other google searches around 'pocket pc paint' or 'wm6 image resize' end up with themes and the like -- I need an on-phone solution.. I don't want to be tied to a computer to resize an image!
searches:
http://www.google.com/search?q=wm6+...s=org.mozilla:en-US:official&client=firefox-a
http://www.google.com/search?hl=en&...ficial&hs=aGH&q=wm6+resize+photos&btnG=Search
http://www.google.com/search?hl=en&...ficial&hs=7vb&q=ppc+resize+photos&btnG=Search -- came up with some results, but I've never haerd of a lot of these solutions, any feedback?
hmm, did you want the original picture to be 3.2 MP? If not, then just take the picture at a lower resolution?
Other than that, although I have not played around with it, an app called Photogenics may be able to do it. Keep in mind though, it's not freeware.
Resco Photo allows you to downsize photos. You can select what pixel size you want, or type in a percentage. Its does a lot more stuff too, its not free though.
I have AT&T and they limit mms to 600k. Is that your carrier as well?
Motorious said:
hmm, did you want the original picture to be 3.2 MP? If not, then just take the picture at a lower resolution?
Other than that, although I have not played around with it, an app called Photogenics may be able to do it. Keep in mind though, it's not freeware.
Click to expand...
Click to collapse
I like taking high-quality pictures in case I want to share them by e-mail / upload them, or save them for later use as something..
But I also want to resize them for friends when i send it to phones. and at&t requires it to be smaller in size to send via MMS... as another poster mentioned.
Cropping would also be nice... I was mainly looking for a free solution, but If i gotta pay I gotta pay.. I prefer donating to developers here over paying for product from companies though.
The authors of XnView (a freeware ACDSee clone) have recently published a version for PocketPCs and Windows Mobile Smartphones. It works very well on my Touch Pro. Allows retouching, resizing, modifying colorspace, batch conversion to many formats and more.
http://www.xnviewpocket.org/
Photo Resizer
» PhotoResizer v1.0 Description
With PhotoResize you can copy and resize JPG images from a folder to another selecting the quality and output size of target image.
This tool is useful when you want to copy your photo from your camera to your PDA and show them at your friends using a PDA as photo album. (As I usally do)
The main problem is that every single image done with your camera (depend wich camera you use) is usually several megabytes and if you simple copy photo from camera in few time you will finish the memory available on your PDA.
With this tool you can reduce the space on each photo resing it to the dimension of your PDA screen (usally 320x240, 320x640, or 640x480). In this manner the dimension of files are drastically reduced and you can show images directly from PDA. During the conversion phase a progress bar will show you the percentage of work, if during conversion will be found an image with dimension less then the output size, that image will be skipped.
Funcionalities:
* Select source folder and destination folder graphically
* Choose target size of images
* Choose quality (default is 75%)
* Choose if you want to see the thumbnail during the process (this option can be time comsuming)
the PhotoResizer v1.0 free for Pocket PC

[Q] 8 bit? Themers Please help

Hi all, i am trying to work on a theme for the Droid X. Can anyone tell me why some of the images open in photoshop incorrectly and more to the point how to fix them?
I cant post a link apparently to the image or a http link since i'm new but
You can view the image here. http:/ / dl.dropbox.com/u/6769503/8bit.jpg
Is there a setting or something I can change in PS to open these correctly?
Thanks for your time.
KraYzeE
krayzee said:
Hi all, i am trying to work on a theme for the Droid X. Can anyone tell me why some of the images open in photoshop incorrectly and more to the point how to fix them?
I cant post a link apparently to the image or a http link since i'm new but
You can view the image here. http:/ / dl.dropbox.com/u/6769503/8bit.jpg
Is there a setting or something I can change in PS to open these correctly?
Thanks for your time.
KraYzeE
Click to expand...
Click to collapse
What is the original file extension? .png?
I had this same problem with some .png files wich had transparency in windows image viewer, but not in photoshop.
My solution was to open it in Paint.net and save it, rewriting the original image. Please be sure to set the transparency correct whilst saving in paint.net.
Download Paint.net
Thanks for the reply, yes it was a PNG, ill try paint.net but i would really like to use Photoshop. I cant understand how it can mess up the transparency and anti alias like that.
Update: Paint.net does indeed open the file correctly... so while i do now have a solution. I would still like to find out why Photoshop (both CS4 & CS5) open it incorrectly ?
Well technically 8 bit pngs are indexed images with a varying amount of colored pixels and then varying amount of transparent and semi transparent pixels so some programs might not like this. I would recommend gimp over ps as its similar but doesn't have this issue.
Sent from my HERO200 using XDA App
that image actually seems correct, can you post an image of the alpha channel? then we will know if photoshop is not reading the file correctly
As one poster said, it's because the images is indexed. If you do Image > Mode > RGB, it will un-index it. I must warn you though, PS is HORRIBLE with indexed images. Use GIMP/Paint.NET to un-index it to save yourself a headache
JAguirre1231 said:
As one poster said, it's because the images is indexed. If you do Image > Mode > RGB, it will un-index it. I must warn you though, PS is HORRIBLE with indexed images. Use GIMP/Paint.NET to un-index it to save yourself a headache
Click to expand...
Click to collapse
Ahh but then you lose the 8 bit optimization, even running optpng will not put it back to index png cause it will ossy optimize it. So just use gimp.
Thanks for the replys guys.
Here is an example image.
http:/ / dl.dropbox.com/u/6769503/btn_circle_pressed.png
If you open it in PS, you will see what i mean, changing it to RGB does not change the image. I can open it correctly it Fireworks, then save it without making any changes, and then i am able to open it in Photoshop correctly.
This will do for now in case anyone else runs into this issue. The file size isn't too much bigger this way, so it will work for now.
Thanks again to all that helped.
http://dl.dropbox.com/u/1631008/btn_circle_pressed_fixed.png
Here's the image fixed, it was indexed... all I did was open it up with osx Preview and save it again. Or you can try this gimp they all talk about but I think it's overkill to switch to another program just because 1 or 2 images are weird, especially after you paid for your copy of Photoshop.
DBBGBA said:
http://dl.dropbox.com/u/1631008/btn_circle_pressed_fixed.png
Here's the image fixed, it was indexed... all I did was open it up with osx Preview and save it again. Or you can try this gimp they all talk about but I think it's overkill to switch to another program just because 1 or 2 images are weird, especially after you paid for your copy of Photoshop.
Click to expand...
Click to collapse
Thanks for your help. I don't have OSX and i absolutely cannot get used to Gimp. but opening it in adobe fireworks and saving it again right away does the trick, so although it's a pain, its simple to do.
If anyone ever figures out a way to directly open these types of files in Photoshop i'd be glad to know.
Cheers
KraYzeE
krayzee said:
Thanks for your help. I don't have OSX and i absolutely cannot get used to Gimp. but opening it in adobe fireworks and saving it again right away does the trick, so although it's a pain, its simple to do.
If anyone ever figures out a way to directly open these types of files in Photoshop i'd be glad to know.
Cheers
KraYzeE
Click to expand...
Click to collapse
Yes that works but your removing the indexing. Android uses indexed pngs wherever possible because this saves space and resources, if you changed every file in the android system to rgba your phone would be noticeably slower.
If you change it to rgba and then run optipng on it you'll see it will not index cause it can only lossy optimize, but if you set the mode to index and then optimize it you'll notice then file will be considerably smaller with little or no image quality loss. So in short your removing a vary important optimization feature of the android system.
If your looking for a quick image conversion tool try image magick, this will allow you to write scripts to convert them png24/32 to png8 and back whole folders at a time.
well as we do with video it's always better to work with uncompressed, high res images. Then when everything is done and set in stone we compress and optimize without loosing too much image quality.
If i had to start a theming project I'll probably do the same, convert everything to high res, work on it then compress to a more optimized format.
DBBGBA said:
well as we do with video it's always better to work with uncompressed, high res images. Then when everything is done and set in stone we compress and optimize without loosing too much image quality.
If i had to start a theming project I'll probably do the same, convert everything to high res, work on it then compress to a more optimized format.
Click to expand...
Click to collapse
Yeah for video thats fine, but in theming and specifically for this file gimp will allow you to work on the indexed file and you literally can not tell the difference with the indexed file being atleast 50% smaller. Maybe this would make sense with an image that has alot of quality or is high res but in this instance it a loss of time and added steps when the same could be accomplished with industry standard tools.

[APP] Image Map (Plus) 2.1 -[R]- 21 JAN 2012 [V][U] 2.1

Image Map is the first fully functional EXIF editor and viewer. It is also a fun application that allows you to easily visualize all your photos on a world map. Image Map main screen starts by reading GPS location information from the image EXIF data and pinpointing the location of each image on a map. For this to work, make sure you selected ‘Include location info in pictures you take’ option by using PICTURES+CAMERA settings.
Additionally this app integrates into your phone Pictures Hub and acts as a powerful and easy to use EXIF editor. In addition to location information you can find out about the model and make of the digital camera used to take the picture, date, exposure, f-stop and other useful info. Exchangeable image file format (EXIF) is a standard that specifies ancillary tags used by digital cameras, scanners and other systems handling image files. Not all pictures carry EXIF data, but if they do Image Map can show this information and if GPS location info is embedded too – Image Map can map it! You can also use Image Map to edit many EXIF fields, change or add location info to other pictures (including downloaded from Internet) and rename photos stored on your phone. This free version has a limit on number of pictures you can save, so make sure to check Image Map Plus too. Image Map Plus has no ads and allows unlimited edits.
This new version has a few significant bug-fixes and improvements:
1. Ability to rename any photo saved on the phone (even without editing EXIF).
2. Integration with GPS.
3. Localization into Russian.
4. Bug-fixes around some special cases of EXIF format.
Download Image Map (for free): http://windowsphone.com/s?appid=f6d38972-f00b-4a25-b6aa-530dcce8b996
Download Image Map Plus (free trial): http://windowsphone.com/s?appid=100bb724-2c49-4ef5-bd19-0a0f3ca8b818
If you want to know more about Image Map please check out one of the following (video) reviews online:
http://youtu.be/dNgJ4mfZML4
http://www.wpxbox.com/image-map-plus-exif-editor-wp/
http://www.addictivetips.com/mobile/image-map-for-windows-phone-7-rename-photos-view-edit-exif-data/
http://wmpoweruser.com/image-map-and-image-map-plus-first-exif-editor-for-windows-phone-7/

[Q] Picture Uploads to skydrive altered

I have photos upload with "best" quality, and to satisfy my curiosity I manually imported a few of the same pictures via USB. The checksums are different, and so are the file sizes by a few bytes.
I examined the files with a hex editor, and they're identical except the pictures uploaded to skydrive via WP8 have some sort of alphanumeric string appended at the end of the file. in the format --blahblahblah1235367--
After removing the appended data, the checksums of the files are the same.
What could this be? What does the string represent? Any ideas?
Possible explanations:
Identifies the file as a mobile upload (rather than a picture you took with your phone, synced to your PC, then uploaded).
Unique identifier for the specific phone that did the upload.
Identifies that the file is to be maintained at full resolution.
Padding to round the file out to a specific size.
Nothing at all, just a bug in the uploading code.

Categories

Resources