How can I use a vtkFollower with a PNG image source? - vtk

I've been searching through the vtk documentation but I cannot see how I can use a PNG image with a vtkFollower.
In order to do so, I seem to need to obtain a vtkMapper with the image data. However, there does not seem to be a mapper for this purpose (i.e. loading of images).
How can I get a vtkFollower of type image?
Note: vtkFollower.SetMapper expects vtkMapper. Since vtkImageMapper does not inherit from vtkMapper, using vtkImageMapper is not possible.

You have to use PNG reader and pass it to texture.
Then, In vtkfollower object "settexture" should be called.
Please refer to links below.
https://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/PNGReader
https://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/TextureMapPlane
https://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/Follower

Related

How to draw custom shapes with draw2d?

I am using draw2d javascript library for drawing predefined shapes and custom shapes in it's canvas.
As I don't have any example made yet, I am trying to copy from it's documentation but doesn't seem to find a good way to research it as it contains a whole lot of it.
Here is the circle example.
http://www.draw2d.org/draw2d_touch/jsdoc_6/#!/api/draw2d.shape.basic.Circle
and here are some more documentation with examples.
http://www.draw2d.org/draw2d_touch/jsdoc_6/
I have premade shapes with html and css and I am trying to drag and drop and render them on canvas like these in this image. Also when dropped, they should have input and output ports too.
Is it possible to convert this html/css to draw2d shapes?
So here this is made possible via extending draw2d's SVGFigure and thus we have ability to provide custom svg to render it as a custom shape.
Below links were useful in this context.
http://www.draw2d.org/draw2d_touch/jsdoc/#!/guide/extending_svg_figure-section-live-example
https://github.com/freegroup/draw2d/tree/master/examples/shape_custom_svg
http://www.draw2d.org/draw2d_touch/jsdoc_6/#!/api/draw2d.SetFigure
https://github.com/freegroup/draw2d/tree/master/examples/shape_labeld
https://github.com/freegroup/draw2d/tree/master/examples/shape_custom_markdown

Python docx image rendering using docx template library

I am trying to render a image to a docx template which has a jinja hook in it.
I am using inlineImage method from docx template using this I was able to render image it is opening in libreoffice writer but not in msword where it should be really using.
In msword a image is rendered but not shown just a blank area is shown.
I do even tried using the subdoc method it is also giving me same results.
Please do help me understand what am doing wrong.
I am using python-docx 0.8.7 and docxtemplate 0.5.17 library to achieve the result
I am bound to use these versions since docxtemplate enforced to use this version of python-docx
I am posting this as an answer so that it may help others trying to achieve the same.
In my code i was using NamedTemporaryFile(delete=None) to create the image before I pass the value to inlineimage as InlineImage(template, tmpfile.name) Which was causing the Issue , I remodelled my logic to directly add the image after doing some resize based on image aspect ratio and send the path of the image instead of filename into the InlineImage method and it worked like a charm.

fabricJS - SVG parameters with toSVG

According to this link, it is possible to modify a SVG, depending on the parameters included in the URL used to access this SVG.
Is it possible to do so using the toSVG() method ?
Let's say I create a basic canvas with a few elements. Once I'm done, I export and save the result of my canvas.toSVG() on AWS.
I get this image
Is it possible to modify the way toSVG() behaves, so that adding ?color=red at the end of the URL would make my tshirt red ?
I tried using the example from the documentation, using replace() on my canvas objects, but this generates empty SVGs.

Object Detection by giving an input image using opencv

I'm new to opencv .My requirement is that in a video by giving an input image it should tag every occurence of the image in the video using opencv. Any help would be much appreciated.
You can try with OpenCV Template Matching
where you have to extract each frame your video and apply Template Matching.
You can see OpenCV video tutorial here. Also see OpenCV documentation Reading and Writing Images and Video.
Load the input image in a global cv:Mat.
Scale this image appropriately, make this the template image(or Mat).
First load the video, then extract each frame out of it and store in a local cv::Mat.
Run template matching as suggested in the tutorial given by Harris with the local frame.
If match found, mark the frame and position using some GUI or color whatever.
Repeat process for next frame.

Send path of SDWebImage stored image to a UIWebView

I need to be able to get a path to images that cached.
While I am wondering if there is a way to do this using SDWebImage, I could probably get away with just having the knowledge to return a path to an image stored in the cache so I can display it within a uiwebview inside an image tag.
According to this https://github.com/rs/SDWebImage/issues/25 it would seem you can simply refer to the image by it's original url and it will be correctly picked up from cache.

Resources