The relation between the size of an object and its projection in camera fame

What is the relation between the size of an object and its projection in camera fame? In this video, I explain how far you should stay from an object to see it at your desired size at camera frame

How to develop GUI Application with PyQt (python Qt)

There are two main methods for developing GUI application with qt:
1) Adding all widgets in your code (your cpp or python code)
2) Creating qt UI files, adding widgets there and load everything into your application.

1)Adding all widgets in your code

Here is the snippet for adding all widgets and their slots in code:

2) Creating qt UI files, adding widgets there and load everything into your application

Now let’s do what we have done in the first method in a UI file and load it. First, create a text file and put the followings in it and save it as “mainwindow.ui”

Now call it in your python file like this:

The results should be the same as what you got in the first method.

Adding Qt UI files to your CMake

Qt uses qmake  to generate classes from UI files and compile everything in the project, luckily there are some macros in CMake that allows you to bring everything into your CMake and build everything there, here is what you need to do:

you can find the full project at my Github

 

Clang format and code beautifier for Qt Creator

Different developers use different styles with different IDE (i.e some people use space, some use tab) which may cause lots of change in your git repository. One solution to this is to use some standard code formatting and beautifier. clang is a great tool for this purpose and can be easily integrated with git hooks and IDE.
First, install it by:

now if you have a file like this:

after running the following:

now you can use it like:

Available styles are LLVM, Google, Chromium, Mozilla, WebKit.

You can config clang for Qt Creator:

go to Tools>Option then:

And then go to the Environment>keyboard and set your shortcut:

This is what I get after pressing shift+s:

 

Every thing you need to know to master git, Part 7, git branch

It quite often happens that a software product is on a git server and developers add new features to the product. To make the job easier, developers usually create branches beside the master branch (which is the default branch) and work on their branch and once the changes are confirmed and tested, they will be merged to the master branch. So let’s get started:

ok now let’s create two branches, one for developer1 and one for developer2,

let’s make some work on the first branches:

and some changes in the second branch:

now you should see this in git gui or if you type:

Now in the git gui, go to merge>local merge and choose b1, you will get the following error because of the merge conflict:

so call the following to solve the conflict:

choose C and save and then: