As @Dave Jones commentedcommented, problem is in function foto_segsfoto_segs()
:
import serial
import os
from picamera import PiCamera
from time import sleep
# Initialize camera global amd only once
camera = PiCamera()
def foto_segs(i):
j=0
for j in range(2):
for i in range(i+8):
camera.capture('%d.jpg' %i)
while True:
#try:
txt = arduino.readline()
print txt.rstrip('\r\n')
if (txt.rstrip('\r\n') == 'camara'):
foto_segs(count)
count =count+18
print count