Human-written demonstration (OpenAssistant volunteers)· OpenAssistant (human-written)
OpenAssistant Conversations (oasst2)
I have photos of individual 45 and LP records. In each photo, the record is in the…
In OpenAssistant data, “assistant” turns were written by human volunteers as demonstrations. They are not model outputs.
- User
I have photos of individual 45 and LP records. In each photo, the record is in the center and is rotated at different angles. The goal is to rotate the image such that the label on the record is upright. Using python, write a program that takes a photo as input and rotates the input photo, then output the correctly rotated photo as a PNG.
- Assistant
No problem, here you go.
import cv2 import numpy as np # Load input image img = cv2.imread('input_photo.jpg') # Convert image to grayscale gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # Detect edges in the image edges = cv2.Canny(gray, 50, 150, apertureSize=3) # Detect lines in the image using Hough transform lines = cv2.HoughLines(edges, 1, np.pi / 180, 200) # Compute the average angle of the detected lines angles = [] for line in lines: for rho, theta in line: a = np.cos(theta) b = np.sin(theta) x0 = a * rho y0 = b * rho x1 = int(x0 + 1000 * (-b)) y1 = int(y0 + 1000 * (a)) x2 = int(x0 - 1000 * (-b)) y2 = int(y0 - 1000 * (a)) angle = np.arctan2(y2 - y1, x2 - x1) * 180 / np.pi angles.append(angle) # Rotate the image by the average angle avg_angle = np.mean(angles) rows, cols, _ = img.shape M = cv2.getRotationMatrix2D((cols / 2, rows / 2), avg_angle, 1) rotated = cv2.warpAffine(img, M, (cols, rows)) # Save the rotated image cv2.imwrite('output_photo.png', rotated)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →