I've tried to find out what format Autocad SHX is, but had no luck so far. What kind of format is it actually (I mean like image, vector, a mix of this, else)?
And how can I convert this to say a bitmap image?
A AutoCAD SHX file is a compiled shapefile. Is indicated here you might find it difficult to natively read. Quote:
An SHX file is the compiled machine code version of an SHP ASCII-based shape entities file, which means that programs can process SHX files much more quickly. All of the vector based fonts in AutoCAD, for example, are SHX files.
So, SHX files can be fonts or shape files. There are libraries out there that can work with shape files like the Teigha for .DWG library or ArcView. Interestingly, for ArcView, if you look here it states:
Shapefiles spatially describe geometries: points, polylines, and polygons. These, for example, could represent water wells, rivers, and lakes, respectively. Each item may also have attributes, that describe the items, such as the name or temperature.
I am sure there are other libraries (like FME) that you might possibly use.
Hope this helps.
Related
I need to process a raster file by scanning every point and radiating around it to find other points of interest. As you may know, a GIS raster file contains millions, if not tens or hundreds of millions of pixel points. I need a platform that will allow me to process this data efficiently. I am slightly familiar with vba but from what I see such image processing capabilities are beyond its scope.
You probably do not want to be starting by coding this from scratch; raster processing in GIS is almost as old as the hills. I suggest you look at something like QGIS as a starting point. If it or the many raster plugins don't do what you want it's time to start learning how to write your own; likely not in VBA.
You probably also want to discover the many helpful answers on gis.stackexchange.com
I am trying to create a frustum using DXF file with my text editor, but unable to find any good solution or way to create it. If anyone knows and would be obliged to help me find a solution DXF file or an example, that would be a great help. Thank You
A frustum is a 3-dimensional figure. While the DXF file format does contain provisions for coordinates in the Z-direction(3rd dimension), you cannot use it to define a true solid model. There are 3DFACE and 3DSOLID entities available, but they do not give you solid model objects like the IGES or STEP file formats would.
That being said, you have a tremendously large task ahead of you to create a valid DXF file in a text editor. There is a huge amount of header information required in a DXF file for even the simplest shapes.
If you are serious about it, your best bet will be to start with a blank (no entities drawn) DXF file that has been created in a CAD package and use that as your base. Then you can add entities to it as needed. You will need the DXF file specification. I use the R2000 spec since it has all the needed functionality while still being backwards compatible with the largest number of systems.
If you are doing a conic frustum, you will need to investigate the ELLIPSE entity, and if you are doing a pyramidal frustum, you will need the LINE entity. Depending on the level of complexity you want and the version of the DXF spec that you work from, you can also use the SURFACE entity, but in a DXF file, this will just be represented as a series of lines forming a grid(polyface mesh).
You can also use the 3DFACE and 3DSOLID entities, but if you really want solid geometry, you're better off using a 3D file format as mentioned above.
In the past i have used PDF images of vector files in an NSImage, the advantage being that i can scale them without losing quality. I know that people usually use jpg and png files, why is this? Do PDF files significantly reduce performance or is there some other reason?
Thank you in advance,
Ben
It depends on what's in your PDF file. If there's enough going on in it, then yeah, a raster image may be faster. The trade-off is, of course, scalability—you end up needing to create 1x and 2x variants for every destination size, or create an icon family (if appropriate), instead of just using one image for everything.
But I think most people create raster resources because that's the sort of tool they're used to: Photoshop, Pixelmator, or Acorn. Not many people use vector editors or write their art in PostScript. (And the field of vector editors available on the Mac is pretty weak.)
My recommendation for a few years now has been an app called Opacity. It's vector-focused, but can export raster images in multiple sizes, PDFs, and even source code.
I use PDF files too, for precisely the same reason that they scale automatically. Apple do the same (look inside the Xcode.app bundle - you won't find much other than .pdf files).
There is no reason to use .jpg or .png files at all.
I am working on a project in which I need to highlight the difference between pair of scanned images of text.
Example images are here and here.
I am building a webapp based on HTML,JS for this.
I found that openCV does support highlighting differences between 2 images.
Also I saw that imageMagick also has such support.
Does openCV has support for doing automatic registration of images?
And is there a JS module for openCV?
Which one is more suited for my purpose?
1. Simplistic way:
Suppose the images are perfectly aligned and similarly illuminated: subtract one image from another pixel by pixel, then threshold the result, filter out noisy blobs, and select the biggest ones. Good for a school project
2. A bit more complicated:
Align the images, then find a way to uniform the illumination, then apply the simplistic way.
How to align:
Find the text area in two images, as being a darker than the file color.
Find its corners
Use getPerspectiveTransform() to find the transform between images.
warpPerspective() one image to another.
Another way to register the two images is by feature matching. It has quite an extensive support in OpenCV. And findHomography() will estimate the pose between two images from a bigger set of matching points.
3. Canonical answer:
Align the image.
Convert it to text with an OCR engine.
Compare the text in the two images.
Well, besides the great help given by vasile, you also need the web app answer.
In order to make it work in a server, you will probably need a file upload form, as well as an answer from the server with the applied algorithm. There are several ways you can do it depending on the server restrictions you have. If you can run command line arguments, you would probably need to implement the highlight algorithm in opencv and pass the two input files a an output one for the program. A php script should be used for uploading the files, calling the command line program, and outputting the result to the user.
Another approach could be using java and JavaCV in a web container like Apache Tomcat, for instance.
Best regards,
Daniel
I'm thinking to build a library to manipulate images(my own image type that I will develop), but first I need to understand the structure of a image
How it is mounted?
About the layer technology...
Where I can find some good resources to understand these things?
Thanks.
That all depends on the image format in question.
Most image formats, however, consist of the following:
A header that contains general file information (how long, what format, dimensions, color space, compression algorithm, etc.)
The pixel data (potentially compressed, in which case some other structure may apply)
Other metadata (EXIF, ...)
Many popular image formats such as JPEG or PNG have freely available specifications of the file format.
If you actually want to work with more complex images, containing layers and such (possibly Photoshop or similar) then things get more difficult. They additionally contain layers, so multiple chunks of pixel data, maybe metadata for the layers, in the case of Photoshop even vector data (for layer masks and other paths), etc.
What's more, most primary file formats used by major proprietary image editing software tend to be not fully specified, at least not publicly. There are resources out there but expect them to be incomplete at best.
Still, starting a project like this without much prior knowledge of image file formats in general might not be a feasible idea.
A good start to everyone that needs to know the basics about digital images is the chapter 2 of the classic book by Gonzalez and Woods, Digital Image Processing.
A short answer, roughly speaking: for manipulation in memory, images are 2D arrays. There are lots of variants, but the 2D array is the classic way.
For C, C++ and Python, take a look on OpenCV. For Python, see PIL. For Java, see JAI. Finally, to a overview about an "image structure", take a close look inside IplImage structure in OpenCV documentation.
Image file formats vary wildly. However, depending on which language/platform you're coding against, you may have generalized means of working with images and translating them into the format you chose. Each platform will have its own means of building and accessing images, however, so there's little I can tell you of substance without a declaration of your programming platform of choice.
Personally, I prefer C#/.NET. So here are some links on image manipulation in that platform:
http://www.aspfree.com/c/a/C-Sharp/Basic-Image-Manipulation-using-GDI-and-C/
http://www.aspfree.com/c/a/Code-Examples/Handling-Animation-and-Bitmaps-Using-GDI-for-Image-Manipulation/
Each image format, has a differant structure and comprresion.
Maybe you should explain in more detail your goals.
A quick amazon search yields a couple of books that could be very useful on the subject. Both are based around openGL, one of the most common graphic libraries. The first is a general introduction to computer graphics sort of text book and the second is a manual for openGL (commonly known as the red book).
Computer Graphics with OpenGL (3rd Edition)
OpenGL Programming Guide (The Red Book)
I can personally attest to the usefulness of both books.
If you're interested in the innards of various image file formats wotsit is a pretty good start. If you prefer hardcopy then go to the Encyclopedia of Graphics file formats. And if you want to look at sample sourcecode check out imagemagick. It can open-, convert to-, and save- most popular image file formats written in C++ with interfaces to most other languages.
Unless you're doing something very unique, I would encourage you to use an existing file format. Look at PNG or TIFF. They are incredibly flexible.
As a veteran in the field, I would say that the last thing the world needs is a new image file format. ;-)