I am writing a python code to detect balls using RPi, Pi Cam, and OpenCV library. I am a newbie to RPi. How can I use Raspberry Pi standalone which works just like Arduino? Thus, there should be auto login and auto execution of a python code.
How can I use Raspberry Pi standalone which works just like Arduino?
You can't use it exactly like an Arduino, or at least not easily, and it would not be very desirable to do so. The Pi is a considerably more complex piece of hardware.
there should be auto login
Unless you are using it in a very unusual way, an Arduino does not require a login or possess the potential for such, etc., because it does not run an operating system. Instead, it is programmed with firmware.
You can enable auto-login using
raspi-config on Pi based operating systems such as Raspbian.
auto execution of a python code
Execution of code at boot does not require anyone logged in. Logically enough, it's the other way around: There must be appropriate software running first in order for anyone to log in.
The first non-kernel code executed on POSIX style operating systems such as Raspbian is init, and everything else descends from this. Note that the current init system is actually systemd, but a lot of documentation refers to the older SysV style init.
In either case, the easiest method to start something at boot is via
/etc/rc.local, which is executed by the init system.