Should ARKit AR Resources choose JPG file or PNG file? - ios

My demand is to recognize object in real world with 2D images using ARKit. I find AR Resources support JPG and PNG format.
My question is:
Whether the white background in sample_jpg affects the judgment of the results?
Should I choose JPG format or PNG format?
The sample images (JPG and PNG) are shown below:
sample_jpg
sample_png
My iOS Sample code: MyARKitDemo
I tried PNG format and JPG format individually. My hunch is that PNG might be better recognized than JPG, and I want to verify if my idea is correct. Thanks!

Related

iOS: Convert PNG to HEIF/HEIC + Alpha without quality loss

For a project I'm currently working on, I'm trying to convert a bunch of PNG images to HEIF/HEIC. These images will be used in Xcode's .xcassets, which will then be "compiled" into a .car file.
Compiling the PNGs (~150 total files) results in ~40 MB of Assets.car, which is why I'm trying to convert them to HEIF/HEIC in the first place. I've tried various solutions, such as ImageMagick, "Export as" in GIMP, biodranik/HEIF, libheif's heif-enc, exporting a PNG as 8-bit or 16-bit in Photoshop and doing everything all over again. But everything results in the .heic file being "broken" on iOS. The first image shows the best output I've got so far, but still fringes around the edges. The white rounded rectangle on the right is iOS' Face ID padlock.
The second image is (I think) a 16-bit PNG converted to HEIC using libheif#1.8.0, upgraded through Homebrew. Lossless quality preset, 10-bit output. heif-enc complained about the color space being converted from RGB to YCbCr, stating even though you specified lossless compression, there will be differences because of the color conversion
Is there any way to properly convert PNG files to HEIF/HEIC without such quality loss? Please don't suggest online services to convert files, as I'd like to keep total control of my files.
Note: To get lossless encoding, you need this set of options. Try :-
-L switch encoder to lossless mode
-p chroma=444 switch off color subsampling
--matrix_coefficients=0 encode in RGB color-space

How to get the PDF from the Cytoscape graph without blurring the image?

I'm able to get the JPG and PNG images from the Cytoscape graph, but when converting them into PDF using jsPDF, the image shrinks and is blurry on zoom-in.
Is there a way the image or graph can be converted to PDF without blurring?
It seems to me like you need to learn the difference between bitmap formats and vector formats.
Bitmap formats like PNG, GIF, BMP and JPEG do not support limitless zooming because they are made of small squares, called pixels.
Vector formats like PDF, SVG and EPS support limitless zooming without blurriness because they are made of geometrical shapes (though PDF can include bitmaps).
So you can convert between bitmap formats without problems (though you may get compression artifacts when using JPEG) but you cannot directly go from vector to bitmap and vice versa.
If you convert a vector image to bitmap, you need to rasterize it to a specific resolution.
If you convert a bitmap image to a vector image, you could use some advanced algorithms to guess the shape behind the pixels, but there is almost never enough information for this to work perfectly.
If you convert a bitmap image to PDF, the tool you are using may just embed the bitmap in the PDF. Now the PDF editor may let you zoom, but the image will get blurry.
The only way to get a real vector PDF is by having the application, in this case Cytoscape, export PDF directly, not converting it afterwards.
You wrote Cytoscape cannot do this but I am reading the manual of version 3.7.0 and it says you can export directly to PDF using "File → Export as Image..." and then selecting "PDF". Maybe at the time you posted this question, this version wasn't released yet.
P.S.: As noted by #ideogram you are using Cytoscape.js and not Cytoscape, so you can use the cytoscape-svg NPM package to export as SVG, which is a vector format, which you can then convert to PDF without getting any blurriness.

Performance and Memory wise is JPG or PNG better for Core Image?

The title pretty much sums up the question but I was wondering if JPG/PNG files have a notable difference in speed and performance when using CIFilters. Is using one type of file preferred over the other? Is there another file type that could be potentially faster than both JPG and PNG?
JPEG and PNG are storage mechanism. Filters have to be performed on uncompressed data, not on JPEG or PNG streams.
The speed difference between JPEG and PNG occurs reading or writing. PNG compression generally is slower than JPEG compression. PNG expansion is generally faster than JPEG.
JPEG is not suitable for images that have abrupt changes in color, e.g. drawings, cartoons.
JPEG is not suitable for images that are stored, retrieved, modified, stored . . . . Each cycle changes the image.
JPEG generally produces much smaller compressed streams than PNG.
It actually depends! PNG's are better if it is a smaller image, as it cuts away the white surrounding what is actually there. But, it does not compress at all to maintain quality. This could slow down performance. JPEG compresses, therefore cutting down file size, but also compromising quality to a point. I'd say go for JPEG if it is a huge image for the app, but go for PNG if you want quality.
Thanks for asking and hope this helps. If this answers your question, I'd love if you could just hit that check mark.
Cheers,
Theo

Losslessly double JPEG resolution without SmartScale

How can I convert a 256x256 JPEG to a 512x512 JPEG without losing any quality? (I can use jpegtran, but that uses SmartScale, which isn't widely supported.)
It must be converted to JPEG specifically. If it cannot be a literally lossless conversion, can it get very close? Virtually lossless? Thanks.
EDIT:
If it's not possible with any existing tool, please tell me if and how it might be possible in theory.
EDIT 2:
The reason I'm asking is because I want to losslessly combine 512x512 image tiles from the internet in order to re-assemble a panoramic image. The problem is that some of these tiles (along the top and bottom rows of the image) are 256x256 resolution, and require stretching before being combined with the other tiles. So in short, most of the tiles are 512x512 and thus wouldn't require reencoding, but some 256x256 tiles would.
If the 256x256 JPEGs became 512x512 JPEGs, I could combine all the tiles with jpegtran without reencoding, and they would form a simple equirectangular image.
I don't want to encode these panoramas to a different format like PNG, if I can help it, but I know I may need to. So I'm wondering if these few half-sized tiles can be scaled up essentially losslessly.

how to convert jpg to tiff inside my app

I have not been able to find any info on creating a TIFF on iOS (or converting a jpg or getting a TIFF representation from a UIImage) in the search engines.
I need to create a TIFF image, preferably from my UIImage or converting from a jpg representation. I see PNG and JPG support but nothing for TIFF images.
The service I am uploading images to requires TIFF (signature capture).
Any help appreciated.

Resources