{"id":25171569,"url":"https://github.com/basemax/imageprocessingtsapi","last_synced_at":"2025-05-05T20:52:34.947Z","repository":{"id":196253545,"uuid":"689024081","full_name":"BaseMax/ImageProcessingTSAPI","owner":"BaseMax","description":"This is a TypeScript-based RESTful API for image processing that includes features like face detection and emotion analysis. Users can register, login, generate API keys, upload images, and receive information about detected faces with their corresponding emotional states (e.g., happy, normal, angry, not happy).","archived":false,"fork":false,"pushed_at":"2025-01-17T11:04:19.000Z","size":11575,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-04T21:45:41.029Z","etag":null,"topics":["express","express-javascript","express-typescript","expressjs","expressts","javascript","js","ts","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BaseMax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-08T16:04:05.000Z","updated_at":"2025-01-17T11:04:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"9b975c3d-126f-40c3-a1c8-f6046e549506","html_url":"https://github.com/BaseMax/ImageProcessingTSAPI","commit_stats":null,"previous_names":["basemax/imageprocessingtsapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FImageProcessingTSAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FImageProcessingTSAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FImageProcessingTSAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FImageProcessingTSAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaseMax","download_url":"https://codeload.github.com/BaseMax/ImageProcessingTSAPI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252576487,"owners_count":21770715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express","express-javascript","express-typescript","expressjs","expressts","javascript","js","ts","typescript"],"created_at":"2025-02-09T09:21:09.518Z","updated_at":"2025-05-05T20:52:34.921Z","avatar_url":"https://github.com/BaseMax.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Image Processing API with Face Detection and Emotion Analysis\n\nThis is a TypeScript-based RESTful API for image processing that includes features like face detection and emotion analysis. Users can register, login, generate API keys, upload images, and receive information about detected faces with their corresponding emotional states (e.g., happy, normal, angry, not happy).\n\n## Prerequisites\n\nBefore you begin, ensure you have met the following requirements:\n\n- Node.js and npm installed on your system.\n- Git for cloning the repository.\n\n## Demo \n\n### Face datection:\n\n![demo](./public/1695062561604-12282911.jpg)\n![demo](./public/output/output_1695062583615.jpg)\n\n![demo](./public/1695063557080-43682558.jpg)\n![demo](./public/output/output_1695063578756.jpg)\n\n![demo](./public/1695243239709-890003583.jpg)\n![demo](./public/output/output_1695243264275.jpg)\n\n![demo](./public/1695243641130-501222217.jpg)\n![demo](./public/output/output_1695243663953.jpg)\n\n### APIs \n\nRegister:\n\n![demo](./screenshots/register.png)\n\nLogin:\n\n![demo](./screenshots/login.png)\n\n## Getting Started\n\nClone the repository:\n\n```bash\ngit clone https://github.com/BaseMax/ImageProcessingTSAPI.git\ncd ImageProcessingTSAPI\n```\n\nInstall dependencies:\n\n```bash\nnpm install\n```\n\nRun app:\n\n```bash\nnpm run start:dev\n```\n\n## Configuration\n\nCreate a `.env` file in the project root and set the following environment variables:\n\n```env\nPORT=3000               # Port for the Express server\nMONGODB_URI=   # MongoDB connection string\nJWT_SECRET_KEY=             # Secret for JWT token generation\n```\n\n## Usage\n\n**User Authentication**\n\nUse the following endpoints for user registration and login:\n\n- POST /api/auth/register for user registration.\n- POST /api/auth/login for user login.\n\nAuthentication is required for the API key generation and image upload endpoints.\n\n**API Key Generation**\n\nAfter successful login, you can generate an API key by making a POST request to:\n\n- POST /api/auth/generateApiKey\n\nThe generated API key should be included in the headers of image upload requests for authentication.\n\n**Image Upload and Processing**\n\nUpload an image and get face detection and emotion analysis results by making a POST request to:\n\n- POST /api/upload/image\n\nInclude the API key in the headers to authenticate the request.\n\nThe API will return information about detected faces and their emotional states.\n\n## Endpoints\n\n**User Authentication:**\n\n- POST /api/auth/register - Register a new user.\n- POST /api/auth/login - User login.\n\n**API Key Generation:**\n\n- POST /api/auth/generateApiKey - Generate an API key for an authenticated user.\n\n**Image Processing:**\n\n- POST /api/face/detect - Upload an image for face detection and emotion analysis.\n\n## Example\n\n### Face Detection\n\nThe Image Processing API uses the face-api.js library for face detection. This library is a powerful tool for face detection and facial landmark recognition. Below, we'll provide more details and examples on how to use it.\n\n### Face Detection Process\n\nUploading an Image: To detect faces in an image, you first need to upload an image to the API using the /api/upload/image endpoint.\n\nAuthentication: Ensure you include the API key in the headers of your request to authenticate.\n\nImage Processing: The API will process the uploaded image and perform face detection using face-api.js.\n\nResponse: You will receive a JSON response containing information about the detected faces, including their positions and emotions.\n\nHere's an example of the response you can expect from the API after uploading an image:\n\n```json\n{\n  \"faces\": [\n    {\n      \"position\": {\n        \"top\": 120,\n        \"left\": 280,\n        \"width\": 150,\n        \"height\": 150\n      },\n      \"emotions\": {\n        \"happy\": 0.75,\n        \"normal\": 0.2,\n        \"angry\": 0.05,\n        \"not_happy\": 0.0\n      }\n    },\n    {\n      \"position\": {\n        \"top\": 200,\n        \"left\": 450,\n        \"width\": 130,\n        \"height\": 130\n      },\n      \"emotions\": {\n        \"happy\": 0.6,\n        \"normal\": 0.35,\n        \"angry\": 0.03,\n        \"not_happy\": 0.02\n      }\n    }\n  ]\n}\n```\n\n## Example Usage\nHere's an example of how to make a POST request to the API to upload an image and receive face detection results using a JavaScript fetch:\n\n```javascript\nconst apiUrl = 'http://your-api-url/api/face/detect';\n\n// Replace 'your-api-key' with a valid API key.\nconst apiKey = 'your-api-key';\n\n// Create a FormData object to send the image.\nconst formData = new FormData();\nformData.append('image', imageFile);\n\nfetch(apiUrl, {\n  method: 'POST',\n  headers: {\n    'Authorization': `Bearer ${apiKey}`,\n  },\n  body: formData,\n})\n  .then(response =\u003e response.json())\n  .then(data =\u003e {\n    // Process the data, which contains face detection results.\n    console.log(data.faces);\n  })\n  .catch(error =\u003e {\n    console.error('Error:', error);\n  });\n```\n\n## Contributing\n\nContributions are welcome! Please follow the Contributing Guidelines for this project.\n\n## License\n\nThis project is licensed under the GPL-3.0 License - see the LICENSE file for details.\n\nCopyright 2023, Max Base\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fimageprocessingtsapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasemax%2Fimageprocessingtsapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fimageprocessingtsapi/lists"}