Importing .wrl into Blender with color - colors

I'm trying to import a .wrl model into Blender as an intermediate step to getting something editable in FreeCAD (I want to cut it into pieces and move them around). When I do the import, the colors are lost. Blender renders the model in gray. I already checked the file to verify it contains color information. Loading the .wrl file in view3dscene shows colors. Loading the .wrl file directly into FreeCAD gives me colors. What did I miss?

Related

Is it possible to make Inkscape autotrace PNG to SVG, but from the command line?

I want to automate "raster to vector" conversions. PNG to SVG. (most Qs here on SO are the other way around)
I have tried the old command line tool autotrace on Linux, but I could not get it to run. I've tried to install a package, and to compile it from the source. Nope.
Then I've realised that Inkscape has "autotrace" now integrated in its codebase. I'd like to convert simple sketches from PNG to SVG.
And I want to do this in a Bash for-loop , with different autotrace settings (number of passes; ignore Speckles with max X pixels width) etc.
I've tried the "action" command-line option
inkscape --without-gui --actions="file-open:my.png"
and this brings up the small "png bitmap image import" dialog, waiting for me to confirm.
Also I've tried the verb command line option
inkscape --with-gui --verb="FileImport:my.png"
and this opens the large "Select file to import" dialog (ignoring my --verb argument)
At this point I gave up.
I want Inkscape to import a PNG picture, autotrace it with some settings, save it as SVG. Perhaps, beofre saving, duplicate the traced layer, lock the imported background layer, rename the layers from path-12345 to "tracesettings-x-y-z" etc.
(my final goal is to permute the tracing settings, to find good ones for my use-case, but that's not the focus of this question)
Inkscape is using potrace and autotrace to trace bitmap images into vector formats such as SVG and PDF.
Let's assume you have an image: foo.png that you want to trace to SVG using potrace:
First, you need to convert your image to a bitmap format (BMP).
Invoke the potrace command
# I am using ImageMagick convert command to convert PNG to BMP
convert foo.png foo.bmp
# Invoke potrace command with SVG backend
potrace -b svg foo.bmp
The result will be: foo.svg.

Open CV, find blurry images

I want a help in python code that should show me if the images in a folder is blurry or not.
I find this article useful https://www.pyimagesearch.com/2015/09/07/blur-detection-with-opencv/
but in the output it shows a text on the top of the image with its blurry value.
But I want the result should generate a text file (output.txt) that shows the image path , it's blurry value and also states whther it is blurry or not. Rather than writing these things on the top of image.
I am using Anaonda 3 and install cv2, argparse and imutils explained in the article.
In output.txt it should be like this

Does the backend matter for savefig

I have a script which plots some pandas data, and then either shows the plot interactively with plt.show(), or saves it to a file with plt.savefig(args.out).
import matplotlib.pyplot as plt
# set up the dataframe here
ax = df.plot.line(x=0, title=args.title, figsize=(12,8), grid=True, **kwargs)
if (args.out):
vprint("Saving figure to ", args.out, "...")
plt.savefig(args.out)
else:
vprint("Showing interactive plot...")
plt.show()
The question is, does the default matplotlib backend matter for the scenario where I save to a file with savefig? It definitely matters in the other case since it's used to display the interactive plot, but if I call savefig is another backend used entirely?
When showing a figure, the backend obviously matters, because it provides two things:
The renderer to draw the image
The GUI within which the image is shown.
When saving a figure, only the former matters. However, matplotlib provides a multitude of export formats. At the end, the chosen backend will determine what to do when a figure is saved, and in most cases, will use one of the existing non-interactive backends to produce the output file.
Some examples:
TkAgg will use the tkinter GUI to show a figure. For saving a png figure, it will fall back to the basic Agg backend to produce the png file. For saving an svg file, it will fall back to the svg backend, for saving a pdf it will fallback to the pdf backend, etc.
TkCairo, will use the tkinter GUI to show a figure. For saving a png figure, it will fall back to the basic Cairo backend to produce the png file. For the rest, same as above.
Qt5Agg will use the PyQt GUI to show a figure. For png will fall back to Agg. For others same as above.
similar for other backends.

Why when importing SVG file from inkscape to blender it's not importing anything?

In inkscape I saved the file as plain svg or as inkscape svg format. The file size on hard disk is about 1.59 MB
Then in blender I opened the add-ons window and searched for svg and check the first addon I also tried to check the second one but it didn't work in any case.
Then I did in blender: File > Import > Scalable Vector Graphic (.svg)
And selected the file and clicked on import SVG:
Then it's thinking for some seconds and then it's staying in the opening window showing the cube. Tt didn't load the file:
In the Inkscape I loaded/opened this jpg file:
Then selected it and then in the Inkscape I did:
Path > Trace Bitmap...
Then clicked on Update and then on OK
Then saved it as SVG and then tried to import it in blender.
The main goal is to use inkscape and blender and to convert the image to 3d object.

Save a drawing made by OCaml graphics in a EPS and PDF file

I made an OCaml program that draws L-systems using the turtle interpretation.
What I'm looking for is to save what I draw with graphics to an image of EPS and PDF file.
But I never done this before and I don't know how to do, so I've looked in graphics librairy and all I've found is get_image to get an Image file and dump_image to get an matrix color from an Image file but from here I don't know how to save the data into a EPS or PDF file.
Does anybody have an idea about how to do that?
I never used it, but there is graphicspdf which implements the Graphics interface but outputs to PDF (opam install graphicspdf). Similar for postscript is GraphPS (not packaged in opam).
Alternatively if you program is well designed you should be able to render to multiple backends. In that case Vg allows you to render to PDF, SVG or the html canvas (opam install vg). There is also ocaml-cairo that provides you bindings to the C library libcairo and allows you to render to multiple rendering backends (opam install cairo).

Resources