This function can be used to retrieve the height (in pixels) of the given camera. Note that this function is only valid for cameras created using camera_create_view() or for those added in the room editor.
Argument Description camera_id The unique camera ID value returned when you created the camera
var vw = camera_get_view_width(view_camera) /
var vh = camera_get_view_height(view_camera) / 2;
camera_set_view_pos(view_camera, x - vw, y - vh);
The above code retrieves the width and height of the camera assigned to view port and then sets its position relative to the center.