Skip to content
🤔prompts chat🧠
🔍
question:查询2023年12月俄罗斯有关建筑的所有展会

answer:很抱歉,我无法提供2023年12月的展会信息,因为在现实时间内,这些展会的详细信息尚未确定。建议您在接近展会时间时候,向相关展会组织者、展览中心或官方网站查询有关建筑展览的信息。

question:每年12月俄罗斯的建筑类展会都有哪些

answer:以下是一些俄罗斯每年12月举办的建筑类展会: 1. MosBuild:这是俄罗斯最大的建筑和内装修展览会,每年在莫斯科举办。展会涵盖了建筑、设计、装修、材料和技术等方面。 2. BATIMAT Russia:这是俄罗斯建筑和室内设计行业的国际展览会之一,是MosBuild展会的一部分。展会涵盖了建筑材料、技术、设备和解决方案等领域。 3. ARCH Moscow:这是俄罗斯著名的建筑和设计展览会,每年在莫斯科举办。展会重点关注当代建筑和设计作品的展示和讨论。 4. CityBuild Moscow:这是俄罗斯城市建设行业的国际展览会,每年在莫斯科举办。展会涵盖了城市建设和基础设施、交通、环境和可持续发展等方面。 5. SIPREMIUM:这是俄罗斯 SIP(结构绝缘板)建筑技术行业的展览会,每年在莫斯科举办。展会聚焦于先进的建筑材料、技术和解决方案。 请注意,展会的名称和时间可能会有变化,建议您在确认之前,向相关展会组织者、展览中心或官方网站查询最新信息。

question:12月俄罗斯的展会信息

answer:以下是一些俄罗斯每年12月举办的展会信息: 1. Metalloobrabotka(金属加工):这是俄罗斯最大的金属加工行业展览会,涵盖了金属加工机械、工具、材料和技术等方面。展会通常在莫斯科举行。 2. All-Russian Exhibition Center(全俄展览中心):该展览中心位于莫斯科,每年都举办多种展览活动,涵盖了许多不同行业和领域,包括建筑、设计、工程、科技等。 请注意,展会的具体日期、名称和地点可能会有变化,建议您在确认之前,向相关展会组织者、展览中心或官方网站查询最新信息。

question:image = cv2.imread("0.4/02.pgm", cv2.COLOR_BGR2GRAY) IMAGE_THRESHOLD = 100 def get_coords_by_threshold( image: np.ndarray, threshold: int = IMAGE_THRESHOLD ) -> tuple: """Gets pixel coords with intensity more then 'theshold'.""" coords = np.where(image > threshold) return coords def delete_pixels_by_min_threshold( image: np.ndarray, min_threshold: int = IMAGE_THRESHOLD ) -> np.ndarray: """Deletes coords from image and returns this image.""" anti_coords = np.where(image < min_threshold) image[anti_coords] = 0 return image def get_neigh_nums_list( coords: tuple, kernel_size: int = 3 ) -> list: """ Gets list with number of neighborhoods by kernel. Returns list like [[x1, y1, N1], [x2, y2, N2]], Where N - neighborhood's number. """ neigh_nums = [] offset = (kernel_size - 1) // 2 for x, y in zip(coords[0], coords[1]): if x < 0 + offset or x > image.shape[0] - offset: continue if y < 0 + offset or y > image.shape[1] - offset: continue kernel = image[x-offset:x+offset+1, y-offset:y+offset+1] step_neigh_num = np.count_nonzero(kernel) - 1 neigh_nums.append([x, y, step_neigh_num]) return neigh_nums def sort_neight_nums_by_N(neigh_nums: list) -> np.ndarray: """ Sort neigh_nums by N parameter. Removes N=-1, N=0 and sorts by N desc. """ np_neigh_nums = np.array(neigh_nums) np_neigh_nums = np_neigh_nums[ (np_neigh_nums[:, 2] != -1) & (np_neigh_nums[:, 2] != 0)] np_neigh_nums = np_neigh_nums[ np.argsort(-np_neigh_nums[:, 2])] return np_neigh_nums def get_potential_points_coords( sorted_niegh_nums: np.ndarray, potential_points_num: int = 100 ) -> np.ndarray: """ Gets best candidates, potential points coords only. Returns np.ndarray like [[x1, y1], [x2, y2]]. """ sorted_neigh_nums = np.delete(sorted_niegh_nums, 2, axis=1) return sorted_neigh_nums[:potential_points_num] # def get_best_lines(potential_points: np.ndarray) -> np.ndarray: # """ # Gets best combinations of lines by all points. # Line y = kx + b. # Returns np.ndarray like [[k1, b1], [k2, b2]]. # """ # best_lines = [] # best_inliers = [] # iterations_num = 1000 # threshold_distance = 3 # threshold_k = 0.1 # threshold_b = 10 # for i in range(iterations_num): # sample_indices = np.random.choice(potential_points.shape[0], size=3, replace=False) # sample_points = potential_points[sample_indices] # sample_x = sample_points[:, 1] # sample_y = sample_points[:, 0] # coefficients = np.polyfit(sample_x, sample_y, deg=1) # distances = np.abs(potential_points[:, 0] - np.matmul(np.vstack((potential_points[:, 1], np.ones_like(potential_points[:, 1]))).T, coefficients)) / np.sqrt(coefficients[0] ** 2 + 1) # inliers = np.where(distances < threshold_distance)[0] # is_similar = False # for line in best_lines: # diff_k = abs(coefficients[0] - line[0]) # diff_b = abs(coefficients[0] - line[0]) # if diff_k <= threshold_k and diff_b <= threshold_b: # is_similar = True # break # if not is_similar and len(inliers) > len(best_inliers): # best_lines = [coefficients] # best_inliers = inliers # elif not is_similar and len(inliers) == len(best_inliers): # best_lines.append(coefficients) # return np.array(best_lines) def get_best_lines(potential_points: np.ndarray) -> np.ndarray: """ Gets best combinations of lines by all points. Line y = kx + b. Returns np.ndarray like [[k1, b1], [k2, b2]]. """ best_lines = [] num_lines = 0 iterations_num = 1000 threshold_distance = 3 threshold_k = 0.5 threshold_b = 20 while num_lines < 3: if num_lines == 0: remaining_points = np.copy(potential_points) best_inliers = [] best_line = None for i in range(iterations_num): sample_indices = np.random.choice(remaining_points.shape[0], size=3, replace=False) sample_points = remaining_points[sample_indices] sample_x = sample_points[:, 1] sample_y = sample_points[:, 0] coefficients = np.polyfit(sample_x, sample_y, deg=1) distances = np.abs(remaining_points[:, 0] - np.matmul(np.vstack((remaining_points[:, 1], np.ones_like(remaining_points[:, 1]))).T, coefficients)) / np.sqrt(coefficients[0] ** 2 + 1) inliers = np.where(distances < threshold_distance)[0] is_similar = False for line in best_lines: diff_k = abs(coefficients[0] - line[0]) diff_b = abs(coefficients[1] - line[1]) if diff_k <= threshold_k and diff_b <= threshold_b: is_similar = True break if not is_similar and len(inliers) > len(best_inliers): best_line = coefficients best_inliers = inliers if best_line is not None: best_lines.append(best_line) remaining_points = np.delete(remaining_points, best_inliers, axis=0) num_lines += 1 return np.array(best_lines) # def angle_between_lines(line1: np.ndarray, line2: np.ndarray) -> float: # """Calculates the angle in degrees between two lines.""" # k1, b1 = line1 # k2, b2 = line2 # angle_rad = np.arctan2(k2 - k1, 1 + k1 * k2) # angle_deg = np.degrees(angle_rad) # return angle_deg # main coords = get_coords_by_threshold(image) image = delete_pixels_by_min_threshold(image) neigh_nums = get_neigh_nums_list(coords) sorted_neigh_nums = sort_neight_nums_by_N(neigh_nums) potential_points = get_potential_points_coords(sorted_neigh_nums) best_lines = get_best_lines(potential_points) print(best_lines) # Visualization plt.imshow(image, cmap="gray") plt.scatter(potential_points[:, 1], potential_points[:, 0], color="red", marker="o") plt.show() # Plot the lines on the image for equation in best_lines: k, b = equation x = np.arange(0, image.shape[1]) y = k * x + b plt.imshow(image, cmap="gray") plt.scatter(potential_points[:, 1], potential_points[:, 0], color="red", marker="o") plt.plot(x, y, color="green") plt.scatter(potential_points[:, 1], potential_points[:, 0], color="red", marker="o") plt.show() Метод get_best_lines не учитывает угла между прямыми, нужно сделать так, чтобы в конечном счете у нас остались только лучшие углы с минимальным углом между ними 30 градусов, а threshold_k тогда можно убрать. Обращаю внимание, что прямых по-прежнему должно вернуться три, то есть, если новая прямая нам не подходит по углу, мы продолжаем искать следующую, пока не найдем подходящую

answer:def get_best_lines(potential_points: np.ndarray) -> np.ndarray: """ Gets best combinations of lines by all points. Line y = kx + b. Returns np.ndarray like [[k1, b1], [k2, b2]]. """ def angle_between_lines(line1: np.ndarray, line2: np.ndarray) -> float: """Calculates the angle in degrees between two lines.""" k1, b1 = line1 k2, b2 = line2 angle_rad = np.arctan2(k2 - k1, 1 + k1 * k2) angle_deg = np.degrees(angle_rad) return angle_deg best_lines = [] num_lines = 0 iterations_num = 1000 threshold_distance = 3 threshold_b = 20 min_angle = 30 while num_lines < 3: if num_lines == 0: remaining_points = np.copy(potential_points) best_inliers = [] best_line = None for i in range(iterations_num): sample_indices = np.random.choice(remaining_points.shape[0], size=3, replace=False) sample_points = remaining_points[sample_indices] sample_x = sample_points[:, 1] sample_y = sample_points[:, 0] coefficients = np.polyfit(sample_x, sample_y, deg=1) distances = np.abs(remaining_points[:, 0] - np.matmul(np.vstack((remaining_points[:, 1], np.ones_like(remaining_points[:, 1]))).T, coefficients)) / np.sqrt(coefficients[0] ** 2 + 1) inliers = np.where(distances < threshold_distance)[0] is_similar = False for line in best_lines: diff_b = abs(coefficients[1] - line[1]) if diff_b <= threshold_b: is_similar = True break if not is_similar and len(inliers) > len(best_inliers): angle_check = True for line in best_lines: angle = angle_between_lines(coefficients, line) if angle < min_angle: angle_check = False break if angle_check: best_line = coefficients best_inliers = inliers if best_line is not None: best_lines.append(best_line) remaining_points = np.delete(remaining_points, best_inliers, axis=0) num_lines += 1 return np.array(best_lines)

Released under the MIT License.

has loaded