Extract voxel coordinates from file - c#

I'm making a game in Unity C# and need to extract voxel position (and ideally color) from my MagicaVoxel editor which saves it's files in the .vox format, and can export in a few other ones.
I'd think it's best to extract this information from the .vox files, but none of my text editing programs could decern it's encoding.
Does anyone know how exactly I should go about getting this data?

Here's the answer in case someone is still interested: with the export option you can save it in the .ply format (click 'point' - export point clouds). If you open the .ply file with a text editor, you will find the coordinates and the associated RGB values.

Related

Is there a standard format for .sprite files?

I'm trying to build a small C# Windows Form, graphics program and I need to save/load sprite sheets. I've searched but can't find a standard file format for sprite sheets, I have however found the .sprite extension.
So my questions are:
Is there a standard format for a .sprite file (e.g. header 15 bytes and contains the length of etc...)
Is there a different file format I should be using for sprite sheets?
I have personally never heard of a .sprite file extension; Googling it seems it may be used for the Scratch language (https://en.scratch-wiki.info/wiki/Scratch_File_Format#Sprite_Files).
Typically though, spritesheets are just image files with multiple images on them. PNG files seem to be the most common, though there is no real reason you couldn't use basically any image file type (though keep in mind some may not have alpha channels, etc.). Most software that packs spritesheets will output in a PNG, and will either split it up based on a grid system or provide a catalog of information (often in JSON format) for splitting the sheet into the subimages you need.

Skip section of PDF when extracting text and Get image coordinates

Currently, I can extract all the text chunks with their location data from a PDF. The problem is that the PDF contains images with text annotations which I do not want including in the extraction.
However, for whatever reason whenever I search the PDF for images, it only finds 1 of the images and usually throws the exception: The colour space is not supported. It's as if it doesn't recognise them as images?
I am not wishing to extract the images, just locate where they start and end in relation to the PDF so I can exempt the text that is on top of the images.
For example:
Where the numbers on the graph are unwanted and need to be removed from the extracted text.
Im just not sure how to:
A) Locate all the images and store the coordinates of where it starts and ends
B) Ignore the text that is on top of the images in the PDF document
(I am using iTextSharp to try and achieve this, but so far I am not having much luck)
I'm not exactly sure how iTextSharp works but the PostScript language reference or the PDF Reference manuals may be a good place to start figuring out what you need to know.
I just cracked open a PDF file in a text editor to check out the format because I haven't seen it in a while and then realized what the problem might be.
PDFs support "Images", and "Stream Objects" which can contain image data. Stream objects actually declare enough information that you can know where they begin and end and write something to manually ignore them.
A Stream Object Header looks like this:
<</Intent/RelativeColorimetric/Subtype/Image/Length 19678/Filter/DCTDecode/Name/X/Metadata 4314 0 R/BitsPerComponent 8/ColorSpace 5247 0 R/Width 290/Height 372/Type/XObject>>stream
It's entirely possible that your particular PDF has only one "Image" and then the rest of it is "Streams".
I suggest cracking it open to take a look. It would also be beneficial if you included some sample code with on the library you're using.
I also found by opening a PDF in a text editor this string /Type /Page which seems to create new pages, so you there's a chance you could count those to determine which page you're currently on.
The header at the top of the document I'm reviewing is %PDF-1.2 and the latest version is 1.7, so there may be some disparity here because of that.
Any chance you can share the PDF file you're working with?

Comparing Two PDFs, Outputting the highlighted differences back in the same pdf

I was able to extract the text from ghost script and was able to compare phrases of text at a time. However the problem was the ghost script output the text in a funky way. I was looking to compare elements by elements (Tables,Text,Images).I am looking to come up with an automated solution to do this. Im looking in to Itextsharp but couldn't find any documentations.
My biggest challenge is iterating through elements and comparing them with in the two PDFs.
Can anyone assist ?
The solution could be
use iTextSharp to extract images and text separately
compare text using google-diff-match-patch (it is available for both C# and Python)
compare extracted images using histograms or even some simple way like this one based on pixels comparision
Tables are not separate objects in PDF but just text objects + lines (or even just a background image with a grid). If you are looking to work with tables then you may be interested to check paid PDF Extractor SDK from ByteScout or open-source Tabula-extractor project which are both capable of detecting and extracting tables.
Disclosure: I'm affiliated with ByteScout

Tracking Word from xls file unity vuforia

Hi I was wondering if it was possible to import data from a xls file into
Unity, and use this with vuforia and c# scripting to be able to track words from the xls file and display there corresponding values from the spread sheet.
I could simply copy the words into a white list to be able to track them, but then how would I go about using this to display each rows information.
To clarify slightly, I have a spreadsheet of car names and there sale prices and mileage. I would want to track the car name and be able to display the price and mileage on screen.
Any point in the right direction would be great
Excel allows you to save the file as a .csv file instead of .xls. If you can use this, you could use the CSVReader from Unify in order to import your data.
If you want to keep the .xls, you could try Unity Quick-sheet, I didn't try it myself.
Once the data are loaded, you can store them in a simple structure and build a List or a Dict out of it, depending on the requirement.
I have never used Vuforia so I won't be able to help you there.

Stegnography - hide text file within another text file in c#.net

I have already seen solution for hiding text files or messages within Image or audio files..
but i want solution for hiding text file within another text files (.txt, .doc, .pdf).
can somebody help for this??
Steganography is based on slightly changing data to "hide" some other set of data within these changes. That's why an image with steganography is slightly different than the original. You can't notice if if you don't know it's there, but the fact is you saved the data as changes within color information of pixels.
.txt file is nothing else than a big hunk of characters. If you tried to somehow change the data to hide something in it, it would result in unreadable text. If you change the color of a pixel from 215 Red to 217 Red, you won't really notice. But changing A to F or Ł is quite noticable.
So no, I don't believe it can be done. At least not with .txt files.
While I agree with #stonehead that at the end of the day if you put something in the file someone can find it, but there are a few tricks out their that may prove to be viable options.
Since most users are not living in their command prompt the most straight forward approach is to misrepresent the file to the GUI. This is a pretty handy trick for this.
http://www.howtogeek.com/howto/windows-vista/stupid-geek-tricks-hide-data-in-a-secret-text-file-compartment/
If you are storing data in a pdf you should have very little problems. I would use PdfClown. Not to get too into it but you will want to read up about the structure of a pdf. With clown pdf you could store an asset inside with no connection to the presentation layer. Given the complexity of pdf files i will almost bet no one will be looking in, i would base64encode the chunk to have it blend in with images and other data it would be difficult for someone to find it by just opening up the file.
Be For Warned ClownPDF C# library is not for the faint of heart and it will help to have some java experience because a lot of their docs are for java.
Hope these options help.

Categories

Resources