Код работает фото отсылает НО, видимо настройки с которыми делается фото не оптимальные, вечером картинка приходит нормальная, видно дорогу. а днем когда света больше картинка полностью засвеченная. Вопросов два
1. Как сделать авторизацию бота (добавить список пользователей которым можно пользоваться ботом) желательно отдельным файлом в котором прописать id пользователей.
2. Основная задача это как получать нормальную не засвеченную картинку. как то передавать параметры может яркость контрастность.
Еще раз повторюсь в питон 0, если не затруднит поподробнее и попроще. В дальнейшем конечно хотелось бы функционал расширить, например передавать температуру в помещении, или например не фото а видео присылать, ну это уже мечты.
Может у кого то есть готовые наработки и он поделится, могу заплатить немного если нужно? В общем приму любую помощь.
фото днем и вечером
![](http://storage4.static.itmages.ru/i/17/0506/s_1494086007_5074851_59f55459b5.jpg)
![](http://storage4.static.itmages.ru/i/17/0506/s_1494086007_5105296_406cf94977.jpg)
Сам код
GNU nano 2.2.6 Файл: robotina.py """ A simple Telegram bot to get photos from a camera """ import cv2 import telepot import time TOKEN = "*****:********" PHOTO = 'test.png' CAM_PORT = 0 bot = telepot.Bot(TOKEN) #def help_cmd(bot, update): # text = ('/start command activates a motion capture mode.\n' # '/stop command does the opposite.\n' # '/shot is used to get an actual snapshot.') # bot.sendMessage(chat_id=update.message.chat_id, text=text) #$config = { # cv2.CV_CAP_PROP_BRIGHTNESS: 50, # camera.CV_CAP_PROP_CONTRAST: 50, # camera.CV_CAP_PROP_SATURATION: 50, #} #for param, value in config.iteritems(): # cv2.SetCaptureProperty(capture, param, value) # # def take_photo(): camera = cv2.VideoCapture(CAM_PORT) # camera.set(16,90) # Wait some time to get ligth in the camera time.sleep(1) rc, image = camera.read() if rc: cv2.imwrite(PHOTO, image) del(camera) return rc def send_photo(chat_id, photo_path, caption): with open(photo_path, 'rb') as photo: bot.sendPhoto(chat_id, photo, caption) def handle_messages(msg): """ The entry point to the message reception """ content_type, chat_type, chat_id = telepot.glance(msg) print(content_type, chat_type, chat_id) if content_type == 'text': text = msg['text'] if text == '/getphoto': if take_photo(): send_photo(chat_id, PHOTO, 'This is a test caption') else: bot.SendMessage(chat_id, 'A problem occurred taking the photo') else: #error_msg = "No se de que me hablas!" error_msg = "I don't know what are you talking about!" bot.sendMessage(chat_id, error_msg) bot.message_loop(handle_messages) print('Listen messages...') while True: time.sleep(5)