This paper presents the shortest pathfinding algorithm for a mobile robot with a global path planning approach in a planar surface and control robot to follow the processed path (virtual). The path is planned based on Image Processing of the real working space map, which is caught by a camera. Firstly, the input image of the map is processed to determine the objects (starting point, goal point, obstacle vertices) as the basis for the road map construction. Then Dijkstra's optimal algorithm is applied to the constructed road map for the shortest path calculation. Eventually, the robot will follow that planned path. Experimental results are considered to be good when the robot can follow the path to reach the goal point with acceptable tracking errors compared with the theoretical simulation results.