I'm trying to Draw line and shapes on an existing image using PyQt5 and PyOpenGL. I have done the following so far:
create an object of QGraphicsView
add an QGraphicsScene() object to it
add an Pixmap into my scene
I also created a class called GLWidget which inherits from QGLWidget.
The problem is that I can not display the GLWidget in the scene. I mean when I do scene.addWidget(glWidget) the functions (initializeGL,paintGL,...) are called but nothing shows on the screen.
I have to say that when I only display the GLWidget like this:
glWidget = GLWidget(self)
self.setCentralWidget(glWidget)
it works fine!
Thanks in advance.
I found the solution in PyQt5 examples in github here:
PyQt5 OpenGL examples
The tricky part was in the initializeGL function which I had to do:
self.gl = self.context().versionFunctions()
self.gl.initializeOpenGLFunctions()
....
I hope it helps!
Related
I am having some real trouble trying to plot nice things with Julia.
I first used PyPlot which I was happy with but I had to be able to change the angle on a 3D plots (in that case using surface) so I now use Plots directly with the camera speficication. I would like to remove the background on a 3D plot.
using PyPlot, the following command :
ax=gca(); ax:set_axis_off
works fine.
When using Plots, I tried the following :
using Plots; pyplot(grid=false)
and then my code for the surface, and it does not change the output.
I also tried the first example on this page :https://github.com/JuliaPlots/Plots.jl/pull/695 and grid specification does not work (grids are the same on every area of the layout).
I tried after updating every package and it still does not work.
Does anyone have an idea about what would the problem be please?
Thank you in advance !
I'm switching a camera between two exported dummies from 3dsmax by setting it to use their matrixWorld properties.
camera_foreground.matrixWorld = (dummy_shot1.matrixWorld);
camera_foreground.updateProjectionMatrix();
This works great but the camera_helper that I've created doesn't inherit the matrix changes.
It doesn't allow me to run updateProjectionMatrix() on the helper itself. I've tried parenting the helper to the original camera. I've also tried to set the helper.matrixWorld to the same dummy_shot1.matrixWorld. What would be the best way to get the helper to update along with the camera it's created for/from?
You can update the frustum of a camera helper with THREE.CameraHelper.update().
Given two cameras: camera1 and camera2, you can switch the CameraHelper transformation from camera1 to camera2 like this :
cameraHelper.camera = camera2;
cameraHelper.matrix = camera2.matrixWorld;
cameraHelper.update();
Note
Another solution that seems more convenient for you, would be to create one THREE.CameraHelper for each camera and switch the currently displayed helper with :
camera1.helper.visible = false;
camera2.helper.visible = true;
In addition, THREE.Layers can also be used to control the currently displayed helper.
3dsmax cameras/camera animation aren't supported by the 3dsmax collada exporter. To get around this I was exporting dummies (from max to threejs) that had been parented to said cameras. I had worried that the dummies would come through without their animation (since the parents (3dsmax cameras) are ignored).
The dummies were coming through fine (I'd thought) since camera location/rotation worked fine when copying matrixes to three.js cameras. The problem arose when trying to get the helpers to do the same (apparent when viewing the scene via a debug camera).
It seems camera_helper objects in three.js don't play nicely with the matrix of these particular dummies (probably because in 3dsmax they are inherting from a parent). What's strange is that the cameras (as mentioned above) work fine.
To get around the issue I used a great maxscript (http://www.breidt.net/scripts/mb_collapse.mcr) to copy/bake all the parent keyframe data from the 3dsmax camera to it's dummy (no longer inheriting). The collada friendly dummy was then exported to three.js where both the camera and it's helper work great with.
Thanks Neeh for help and questions. It was rebuilding a test scene to upload that I noticed the new dummies (not parented to cameras) worked fine with helpers.
Does anybody know how to add focus effect to UIImageView so background will be a little bit blurred. Below is an example image
Image Source: http://cdn-media-2.lifehack.org/wp-content/files/2011/09/focus1.jpg
You should UIBlurEffect.
var vEffect = UIVisualEffectView(effect: UIBlurEffect(style: .Light))
vEffect.frame = imageView.bounds
imageView.addSubview(visualEffectView)
Found this one in GitHub. "You can use blur effect and it's animation easily to call only two methods."
https://github.com/marty-suzuki/SABlurImageView
Hi i just developed one demo project using CLImageEditor in Objective-C. You can download my demo for your use from https://github.com/nitingohel/NGFocusView
RunTime output is:
If I export the max project as an .FBX it will work (HERE - the pedal depresses ok), but then I loose turbo smooth (wheel alloys) and line objects (cables) disappear (why is that btw?). Using the Verold exporter, the animation asset appears in the 'key frame animation' tab in the 'choose asset' section, but when applied it never actually animates. And yet, if I animate a simple box next to the pedal, that works (HERE).
Partial solution: It seems the problem for Verold was that the pedal's parts were grouped, it works if they are attached instead. –
To clarify, it sounds like there are three issues:
Your TurboSmooth modifier is not being applied when exporting to FBX
Your line objects are not rendering
Your animation is not playing correctly, when exported by Verold Publisher
To apply TurboSmooth when exporting to FBX, please see the following:
http://answers.unity3d.com/questions/23085/3ds-max-fbx-turbosmooth-export.html
Note that line objects are not currently supported in Verold Studio, so they will not render.
Regarding animation, when I look at your first example, I see an animated pedal. In your second example, I see an animated box. Should there be additional animated objects in either example?
am working on an app where i am loading one image from the bundle and with the help of quartz i am adding two red circles on that image, the image is loaded in the instance of the UIImageVIew class.
I want to save the image with the red circle, so far i have found only one method and thats
UIImageWriteToSavedPhotosAlbum(UIImage * image,id completionTarget,SEL completionSelector, void * contextInfo)
but its not working as it is saving the image from the bundle only, in some post i have read that it can be done using CALayer but i found no useful link to do that, i would be glad if you can post me the answer or any tutorial link to do that.
Here's a trick! Refer to Capture UIView here, you can capture the UIImageView snapshot and save it using UIImageWriteToSavedPhotosAlbum.