How to detect CAD dwg/dxf file is 2D or 3D? - dll

I want to use CAD dwg/dxf file, but before use I need to identify programmatically that the given file is 2D file or 3D file.
So, is there a way to detect CAD dwg/dxf file is 2D or 3D?
Please suggest any way to detect that given file is 2D or 3D.
Please note that I want to detect 2D/3D from server.

Related

Is there a way to identify/detect shapes on a PDF or Illustrator file programmatically?

I'm trying to discover if there is a way, a library, or tool today that would help me to detect the shapes programmatically on a PDF file or an Illustrator File. I have seen some libraries such as Shapely or Pyclipper but haven't been able to use a PDF or AI file as an input for the library to process.
I know this is possible using image processing libraries but converting the file to an image would lose its layers and properties. Any alternatives?

How to train tensorflow object detection image segmentation mask_rcnn_inception_resnet_v2_atrous_coco instance segmentation on my own dataset

please help me with training my own dataset on mask_rcnn_inception_resnet_v2_atrous_coco model.
https://github.com/tensorflow/models/tree/master/research/object_detection
model:https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md
I have refered to https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/instance_segmentation.md ; but I can't clearly understand the steps.
Do we have to give the Bounding box coordinates of the object along with the mask.png file?
How to convert the mask data to tfRecord files (for instance segmentation).?
Can anyone suggest the labelling tool used for bounding box as well as mask.png file!!
tools like LabelBox, labelme, labelimg gives either bounding box coordinated or mask.png file or the polygon coordinates for the object.
please help
The best you give png mask and xml labelization it should be working with create_pet_tf_record.py, set faces_only=false in this file... You can see into the code what is expected in this file..
change path into to point your directories in pipeline configuration
Do we have to give the Bounding box coordinates of the object along with the mask.png file?
Answer: Yes, you need the original images, bounding box files, and mask images.
Use the following tool to annotate each object in your original images Label image
Once you're done with this, you need to annotate each pixel inside each bounding box. There are several tools you can use, for example you can use these tool VGG annotator

Found an OfficeDraw file with shapes. Can the shapes be used without continuous copy-and-paste?

I downloaded an OpenOffice Draw document with shapes I want to use (for drawing Apache Camel diagrams). I'm not very familiar with Draw, but I've used Visio; in Visio, there was a kind of file in which you could find/put shapes, then use to create drawings from those shapes. The shapes appeared in a panel left of and smaller than the drawing, and you could drag a shape from that panel to the drawing to put an instance of that shape on your drawing; the original shape remained on the smaller panel.
I think Visio called the file that held the shapes you could use a "template"; Draw has templates, but I haven't found a reference to them holding shapes to drag onto a drawing. I've tried looking it up, but am hampered by not knowing what terms Draw uses for these things. Can someone tell me whether this is possible in Draw, and what things I should look up help on? I hate to read a whole manual to find out how to use one feature, without even knowing if the feature exists...
--
I'm sorry, I should have done better describing what I have tried. The file holding the shapes is an odg file; it opens fine as a document, and the program allows me to save it as a template, but the behavior of being a collection of shapes that I can drag onto a new drawing repeatedly, without having to copy a shape each time, is not there. That's the feature I'm trying to find.
My version (LO 5.2.3.3/openSuse) allows the creation of a new shape gallery theme (see: View>Clipart Gallery), and the addition of various graphic format files to that theme.
Also, in context meni of a shape, I can edit with external program.
So, I guess, you can save the shape(s) in a file and add it to My Shapes theme.
There will be two new files in ~/.config/libreoffice/5/user/gallery with the shape(s), to backup/restore (to a new installation) or distribution (to other computers).
Edit if your version of the office suite is lacking of that menu options, maybe you can extract the shapes from the *.odg file: unzip it and look for a custom *.sdv and *.thm file in the archive.

How can I write Barcode Generator?

I would like to make a program that takes input as a string like 'dsfljsfkj' then output 2D Barcode (DataMatrix format, or other 2D formats) as an image file in VB.NET
Do you have any idea how can I make it without using any other commercial .dll's? Open-source is OK.
check out the google ZXing project:
http://code.google.com/p/zxing/

Saving "heavy" figure to PDF in MATLAB - rendering problem

I generate a figure in MATLAB with large amount of elements (100000+) and want to save it into a PDF file. With zbuffer or painters renderer I've got very large and slowly opened file (over 4 Mb) - all points are in vector format. Using OpenGL renderer rasterize the figure in PDF, ok for the plot, but not good for text labels. The file size is about 150 Kb.
Try this simplified code, for example:
x=linspace(1,10,100000);
y=sin(x)+randn(size(x));
plot(x,y,'.')
set(gcf,'Renderer','zbuffer')
print -dpdf -r300 testpdf_zb
set(gcf,'Renderer','painters')
print -dpdf -r300 testpdf_pa
set(gcf,'Renderer','opengl')
print -dpdf -r300 testpdf_op
The actual figure is much more complex with several axes and different types of plots.
Is there a way to rasterize the figure, but keep text labels as vectors?
Another problem with OpenGL is that is does not work in terminal mode (-nosplash -nodesktop -nodisplay) under Mac OSX. Looks like OpenGL is not supported. I have to use terminal mode for automation. The MATLAB version I run is 2007b. Mac OSX server 10.4.
This is a funny one. Your problem is not Matlab, it's Ghostscript (Matlab creates PDFs by calling Ghostscript, at least on Windows). When I run
x=linspace(1,10,100000);
y=sin(x)+randn(size(x));
plot(x,y,'.')
print -dpsc2 test.ps
I've got a 2Mb PS file (all vector, of course), which when compressed became a 164Kb ZIP. One would expect to get more-or-less the same result when converting PS to PDF, but ps2pdf test.ps produced your 4Mb file!
Since you are on a Mac, you probably have Distiller. I'd give it a try — generate PS files as above, and then run them through Distiller; you should get a 150K vector PDF.
If you insist on rasterizing, I can suggest printing the figure without any axes or labels to a tiff, opening the tiff, and recreating axes and labels on top of it.
If you don't want to go with a 2D histogram (i.e. an image where pixel brightness corresponds to density of points) as BlessedKey suggests, it looks like the only good way is to do the rasterizing yourself, as mentioned by AB.
getframe followed by frame2im seems to be the way to go for that. Unfortunately, getframe returns empty if you run with -nodisplay. Therefore, you'd have to save the figure as .fig, and on another computer run a script that
opens the figure, gets the content of the axes with getframe, displays the image from getframe and then saves to pdf.
As an alternative to simple plotting or a 2D histogram, you may want to look into scattercloud, which combines plotting the points with density information, by the way.
If at all possible you should try to subsample your problem before building the illustration. If you are plotting points on a curve then 10,000 is probably more than you need. A modern printer is only about 600 DPI afterall.
If the points are illustrating a cloud with some density properties, a better solution may be to build a two dimensional histogram first, and illustrate that with imshow or imagesc.
If multiple clouds are being illustrated with different colors you may be interested in building one such image for each cloud and the combining them with transparency.