I'm trying to change the focus point on the Camera from a click in a live view frame using the EDSDK lib. I can't figure out how to do it, i mean, don't know what property I must set in order to change the focus point. Do you guys have any idea or any sample?
By the way, I'm already able to change some other values like ISO, AV, TV or color temperature.
Thank you in advance!
Set an EdsPoint into kEdsPropID_Evf_ZoomPosition before triggering a focus command. The name "Zoom" is a bit confusing, but this property:
Gets/sets the focus and zoom border position for live view. The focus and zoom border is set using EdsCameraRef, but obtained using live
view image data, in otherwords, by using EdsEvfImageRef.
you can set zoom point adding this method to the camera class.
public void SetZoomPositionSetting(PropertyID propID, Point value, int inParam = 0)
{
CheckState();
int size = Marshal.SizeOf(typeof(Point));
ErrorCode err = CanonSDK.EdsSetPropertyData(CamRef, propID, inParam, size, value);
}
and call this method like this.
MainCamera.SetZoomPositionSetting(PropertyID.Evf_ZoomPosition, p);
p in here is EOSDigital.SDK.Point instance.
and dont forget to change camera setting to AF Live mode.(not quick mode)
Related
When selecting a Marker an InfoWindow pops up.
Sometimes the selection of a Marker is difficult. Especially when the map is rotating in the direction of navigation.
How can I increase the 'touch circle' so that selection is easier?
Update: I have to change the hitTest() for the Marker by subclassing.
I would like to check whether the 'hit' (or touch) was within a circle of X pixels around the point of the Marker. The icon will rotate while I navigate, so I guess I don't use the icon.
How can I do that?
public boolean hitTest(final MotionEvent event, final MapView mapView){
final Projection pj = mapView.getProjection();
pj.toPixels(mPosition, mPositionPixels);
// Does mPositionPixels contains the x, y of the Marker?
// Should I draw a Rect around this point, or could it be a circle?
// How can I check whether the event.getX(), event.getY() is a hit?
return hit;
}
Method proposed by spy is feasible.
You can also create your icon bitmap with an area of transparent pixels around. This is a very simple way to increase its touch area.
I believe #Mker would say, extend the Marker class and override the method hitTest. That is used for the Marker itself. I'm not sure if you can change this for the InfoWindow itself.
I'm creating a iOS video camera app using Qt5.4.
For this I need to determine the current orientation of the device to rotate the video in the VideoOutput element.
As we can see there's a autoOrientation property but it doesn't work as I expect: if I keep switching the orientation it starts to have a weird behaviour i.e. setting the wrong orientation.
Then I tried to apply the rotation based on the Screen.primaryOrientation property:
Copying the function defined in this example, I've a created a similar version, which you can find here.
I call it every time width or height changes, like this:
onWidthChanged: { video.orientation = changeOrientation(); }
onHeightChanged: { video.orientation = changeOrientation(); }
However, it seems that the Inverted orientations are completely ignored, which is strange since they are listed in the documentation.
Anyone has any idea about why it's happening?
UPDATE:
I could isolate the problem when using autoOrientation, basically there's a menu on top of the VideoOutput, the menu is a RowLayout, it's visible only if the user clicks on the menu icon, and only if the user clicks on the menu icon the orientation gets messy.
However, in any situation the InvertedPortrait is not recognized.
Using Qt5 official release --
I need to save the x,y properties of an image element. This
QObject* pic = rootitem1->findChild<QObject*>("image_objectName");
int x = pic->property("x").toInt();
gives the value the property was originally set with, but what I need is the current value after the image has been moved by the mouse. I'm probably missing something simple but I can't find any thing else on it. Really would appreciate any help, THANKS.
So, this is my problem: I have this very big image, and I want to show only a specific part of it. After the user pressing a specific key I want the image to move, showing another part of it. The transition from one part of the image to another have to be smooth, animated.
I tried using a QLabel to show the image but it always shows the center of the image, and I do not really know how to make the animation. What would you guys suggest?
Interesting question. Here is something I just tested and seems to work.
Add a QGraphicsView with dimensions the dimensions of the part of the image you want to display, eg 100x100. Create a QGraphicsScene and add it to the view:
QGraphicsScene* pScene = new QGraphicsScene(this);
ui->graphicsView->setScene(pScene);
Now add your image into the scene. In my case I has an image in my resource file. The trick is to set the sceneRect to the position you want to display. I wanted to display an 100x100 part of the image starting from 0,300 :
pItem = pScene->addPixmap(QPixmap::fromImage(QImage(":/photos/image")));
pScene->setSceneRect(0,300,100,100);
In order to test the smooth moving I added a button which when clicked is triggering a slot called move. This slot simply updates the sceneRect. In my simple example I just move the image 100 pixels right. In a real world scenario you could also move it diagonally or vertically and check the image limits.
void move()
{
for (unsigned i=currentX; i<currentX + 100; i++)
{
ui->graphicsView->scene()->setSceneRect(i,300,100,100);
qApp->processEvents();
}
currentX += 100;
}
Notice the currentX variable. It is nothing more than the last image position. Also we must call the processEvents in order to "see" the image moving smoothly.
You could use QPixmap::copy( int x, int y, int width, int height ) to copy a region of the image and display that.
Few options:
Try using a Q3CanvasSprite (within in a Q3Canvas). It is designed more for splitting one image into multiple ones but not for animating between them. You could try abusing it and declaring (say) 100 frames (10 per digit, which would be used as animation steps) or just use the move() method.
Try QGraphicsPixmapItem::setOffset() (within a QGraphicsScene). This might be overkill as QGraphicsScene is made for large number of images).
I'm not sure, but maybe this can be done with QStateMachine and QAbstractAnimation.
I have created my own class by extending QGraphicsItem and I want to make it so that when someone does a wheel even while over this item, it scales.
This way, i can have multiple items in a scene, and scale each of them in and out as I please.
The problem is, I want the item to scale under the mouse cursor, much like google maps does. That is, a move forward will keep panning the image and scaling it, so taht the area in the vicinity around my mouse pointer is always in view.
void ImagePixmapItem::wheelEvent ( QGraphicsSceneWheelEvent * event ){
update();
qreal factor = 1.2;
if (event->delta() < 0)
factor = 1.0 / factor;
scale(factor, factor);
scaleFactor *=factor;
this->scene()->setSceneRect(0,0,this->boundingRect().width(), this->boundingRect().height());
}
This is the code I am using to do the scale. The problem is, it always seems to be scaling from the top left corner. Well, this is undesirable, beacuse if I scale in or out too much, eventually my area of interest around the mouse pointer has moved off the screen, and I have to either scroll manually or pan to the location, zoom, pan, etc, until i get to the desired level.
I tried to use the QGraphicsItem::setTransformOriginPoint, but no matter what values I put in there, it still seems to scale and such from the top left.
What can I add to that code I posted to get the desired effect?
I have achieved similar functionality in my Image-Manipulation application (scaling the view and having the area under my mouse stay in place and visible) but I scale the whole graphics-view not a specific item, so I don't know if this code can solve your problem.
Anyway, this is what I do in the constructor of my subclassed QGraphicsView (after I set the scene):
setTransformationAnchor(AnchorUnderMouse);
setResizeAnchor(AnchorViewCenter);
I also use the above functions, after each call to:
MyGraphicsView->setTransform(transform);
I'm not sure if this can help you, but I hope so.