묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결자바 ORM 표준 JPA 프로그래밍 - 기본편
.find 질문
.find 로 테이블 조회를 할때 pk 값이 아닌 여러개의 조건으로도 테이블 조회가 가능한가요? 동영상 시청과 현재 김영환님의 책 51p 학습중입니다..
-
미해결Vue.js 완벽 가이드 - 실습과 리팩토링으로 배우는 실전 개념
vue기반의 framework를 사용할지말지 고민됩니다.ㅠㅠ
quasar 등 framework를 사용하지 않아도 개발하는데 무리가 없나요?!혹시 캡틴판교님은 저런 framework를 사용하시는지도 궁금합니다!
-
해결됨자바 ORM 표준 JPA 프로그래밍 - 기본편
hibernate.properties not found 오류관련
안녕하세요 강사님. 제가 웹개발은 거의 처음이라.. 너무 당연한걸 질문 드린거같긴 한데요 익숙치가않네요ㅠ 아래와 같은 오류가나는데 어디를 보면 좋을까요?
-
리버스쿨 Level1 - 리버싱 분석 초급과정
ppt파일은 어디서 공유되나요?
삭제된 글입니다
-
미해결홍정모의 따라하며 배우는 C++
매개함수로 포인터를 넣을 때와 struct 나 클래스를 넣을 때 연산량 차이?
안녕하세요 교수님, 함수에 매개변수로 struct 나 class 를 넣으면 포인터로 넣었을 때보다 메모리 사용량이나 연산량이 늘어나거나 하나요?
-
미해결디자인 패턴 with JAVA (GoF)
더 이상 지원하지 않는 기능
따로 안내가 있거나 강의에 변경이 있어야 할것같습니다
-
미해결직접 만드는 노션 템플릿 BEST 7선
세로형 보드
보드가 한 페이지에서 가로로 계속 늘어뜨리는 형태이던데 한 페에지에서 여러개의 보드를 세로형으로 늘어뜨리는 방법이 없을까요? 한 페이지에서 보드는 1개만 생성되는듯 하더라구요. 한 토픽(가로 한줄)에 5개 정도의 그룹만 관리하면서 세 개의 토픽(가로 세줄)으로 나눠서 총 15개의 그룹을 한 페이지에서 관리하고 싶네요 ㅠㅠ
-
미해결쉽고 빠르게 끝내는 GO언어 프로그래밍 핵심 기초 입문 과정
왜 matchnode함수에서는 ParseMainNodes함수와 생김새가 다른가요?
func parseMainNodes(n *html.Node) bool { if n.DataAtom == atom.A && n.Parent != nil { return scrape.Attr(n.Parent, "class") == "row" } return false } func matchNode(n *html.Node) bool { return n.DataAtom == atom.A && scrape.Attr(n, "class") == "deco" } 왜 parseMainNodes 함수를 matchNode처럼 한 문장으로 표현하면 에러가 나고 왜 matchNode 함수를 parseMainNodes처럼 if문을 사용하면 에러가 나는지요 ㅠㅠ 하루종일 삽질하다가 matchNode가 문제인 걸 찾았는데 , 왜 matchNode를 parseMainNodes처럼 구현하면 안되는지요?
-
미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
jwt 와 passport-jwt 에 대해서 질문 하나만 드리겠습니다.
안녕하세요. 강의를 쭉 수강하고 나서 , 스스로 어플의 로그인 기능을 구현하려고 고군분투 중입니다. 강의와 직접적인 연관은 없는 부분이라 질문을 드려도 될지 모르겠습니다 ㅠㅠ 보통 모바일 어플의 경우 어플이 종료되거나 기기가 꺼지더라도 항상 로그인 상태가 유지 중인데, 그것을 세션이 아닌 jwt 로 구현한다는 것을 알았습니다. 강의 중에 sign() 메서드로 jwt 발급과 verify() 메서드로 검증하는 방법을 배웠는데, 구글에서 passport-jwt 를 사용하라는 글을 봤습니다. 제가 궁금한 것은, 최초의 로그인 후 sign() 메서드로 jwt를 발급하고, 그 발급된 jwt 를 클라이언트의 앱에 심는다고 한다면, 그 이후로 verify()를 통해 심어진 jwt를 검증하면 이 사용자가 허가된 user 인지 아닌지 알 수 있지 않나요? passport-jwt 를 사용해야하는 이유가 혹시 뭔가 있을까요? {session : false } 라는 option 때문에 사용하라고 하는 것인지... 제가 무언가를 잘못 생각하고 있는건지ㅠㅠ... 수업과 직접적인 연관은 없지만 코멘트 남겨주시면 감사하겠습니다!!
-
미해결홍정모의 따라하며 배우는 C++
정적변수 강의에서 Static, Const static 질문입니다.
안녕하세요! 정적변수 강의에서 직접 코딩을 해 보다 의문점이 생겨 질문드립니다. static 변수에서는 말씀해주신대로 주소와 값 모두 출력이 잘 됐습니다. 하지만 Const static의 경우 주소 출력이 문제가 됩니다. 주소가 문제 된다는 것도 원인을 하나하나 제거하다보니 알게 된 사실이네요ㅠ 에러는 Undefined Symbol ...Something::m_value 라고 뜹니다. 왜 주소출력에서 문제가 발생하는 건지 궁금합니다! 아래는 작성한 코드입니다. 시간 내 주셔서 감사합니다! #include <iostream> using namespace std; class Something { public: const static int m_value = 10; }; int main() { Something sth; cout << &(sth.m_value) << " " <<sth.m_value << endl; return sth.m_value; }
-
미해결예제로 배우는 스프링 입문 (개정판)
9분 10초쯤에 빌드 질문이요
애플리케이션을 다시 띄우지않고 빌드만 해서 변경사항이 반영되었는데요? 어떨때는 다시 재실행해야하는데 왜 이번에는 빌드만 해서 가능한지 알고싶습니다.
-
미해결쉽고 빠르게 끝내는 GO언어 프로그래밍 핵심 기초 입문 과정
[재 질문2]구조체가 참조형 인가요
구조체가 참조형이라는게 알려주신 소스를 보고는 파악이 안됩니다. 슬라이스나 맵을 함수에 인자로 전달 하면 무조건 메모리 주소가 전달 되니 참조형 이라는 건 알겠는데 구조체는 변수나 배열처럼 값으로도 참조형으로도 전달 할 수 있으니 참조형도 가능하고 데이타 형도 가능하다고 해야 하지 않나 생각을 합니다만 제가 잘 못 이해하고 있는건가요 바쁘신 중에 죄송합니다만 답변 부탁 드립니다.
-
미해결자바 ORM 표준 JPA 프로그래밍 - 기본편
연관관계 편의메소드 관련 질문이 있습니다.
Member를 Team을 추가 할 때 public void setTeam (Team team){ this.team = team team.getMembers().add(this) } 위와 같이 연관관계 편의 메서드를 만드셨는데, 제거 할 때도 위와 같이 양쪽에서 동시에 제거하는 메소드를 만드시는지 궁금합니다. 제가 실습중인 코드에서는 delete : /team/{team_id}/member/{member_id} 로 api를 호출하면 아래 메소드가 호출됩니다. public void removeMember (Long team_id, Long member_id){ Team team = validateTeam(team_id); //team 이 실제로 있는지 확인 Member member = validateMember(member_id); //member 가 실제로 있는지 확인 if(team.equals(member.getTeam())){ //의문점 team.getTeam().remove(member); memberRepository.deleteById(member.getId) } } Team에 Member를 추가 할 때와 같이 Member를 제거 할 때도 양쪽에서 같이 제거해야하는지 그리고 entity에서 remove관련 편의메소드를 만들어야하는지 궁금합니다.
-
미해결Vue.js 완벽 가이드 - 실습과 리팩토링으로 배우는 실전 개념
클론 어떻게 성공하긴 했는데 궁금한 점이 있습니다.
레포 찾을 수 없는 경우의 해결방안에 ssh키 등록이 있길래, 혹시나 해서 등록해보고, git clone git@github.com:joshua1988/vue-advanced.git 이렇게 쳐서 클론 성공했어요ㅠㅠㅠㅠㅠ 근데 ssh키와 클론 가능여부가 상관이 있나요? 그리고 ssh키 등록하고도 그냥 선생님의 깃헙 주소를 복사했을 때는 안됐는데요. 다른 분들과 다르게, 그대로 복사하면 안되고 git@github.com:joshua1988/vue-advanced.git 이 주소를 쳐야 가능했던 이유가 무엇일까요?? 해결은 했지만 잘 이해가 안됩니다ㅜㅜ
-
미해결쉽고 빠르게 끝내는 GO언어 프로그래밍 핵심 기초 입문 과정
[재 질문]구조체가 참조형 인가요
알려주신 링크를 봐도 제가 잘 이해를 못하는건지 구조체 자체가 참조형이라는 정확한 설명이 없는거 같습니다만..혹시 mutable개체 라는게 참조형이라는 건지요? 강의 중에 구조체를 %v로 출력 해 보면 &가 붙어서 출력이 되기에 구조체 라고 들었습니다만...잘 이해가 안되는데 강사님의 생각을 알려주시면 감사하겠습니다.
-
미해결[개정판] 파이썬 머신러닝 완벽 가이드
loc 슬라이싱
loc 인덱싱시에 명칭기반 해석시, 1:2에서 앞의수는 포함 뒤에수는 미포함 아닌가요? 왜 2개가 나오는지 궁금합니다. ix 인덱싱시에는 같은 명칭기반으로 1:2가 1포함, 2 미포함으로 해석이 된것같아서 헷갈립니다.. ㅜㅜ
-
미해결워드프레스 제대로 개발하기 - 어드민 편
네임스페이스 중복을 회피하신다고 한부분이 궁금합니다.
(function () { }()); 이거 쓰면서 언급하신 부분이 궁금하네요. 정확히 왜 쓰는건지요?
-
미해결Vue.js 중급 강좌 - 웹앱 제작으로 배워보는 Vue.js, ES6, Vuex
git 권한 요청합니다.
id : jtyang0227@gmail.com
-
미해결OpenCV 를 활용한 명함인식 기능 구현 강좌
강의 마지막 예제에서 다음과 같은 에러가 발생합니다.
images/scannedImage.png only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices코드는 아래와 같습니다.# (참고) OpenCV - 이미지에서 텍스트 영역만 찾아내기 # 출처: http://www.danvk.org/2015/01/07/finding-blocks-of-text-in-an-image-using-python-opencv-and-numpy.html import glob import os import random import sys import random import math import json from collections import defaultdict import cv2 from PIL import Image, ImageDraw import numpy as np from scipy.ndimage.filters import rank_filter def dilate(ary, N, iterations): """Dilate using an NxN '+' sign shape. ary is np.uint8.""" kernel = np.zeros((N,N), dtype=np.uint8) kernel[(N-1)/2,:] = 1 dilated_image = cv2.dilate(ary / 255, kernel, iterations=iterations) kernel = np.zeros((N,N), dtype=np.uint8) kernel[:,(N-1)/2] = 1 dilated_image = cv2.dilate(dilated_image, kernel, iterations=iterations) dilated_image = cv2.convertScaleAbs(dilated_image) return dilated_image def props_for_contours(contours, ary): """Calculate bounding box & the number of set pixels for each contour.""" c_info = [] for c in contours: x,y,w,h = cv2.boundingRect(c) c_im = np.zeros(ary.shape) cv2.drawContours(c_im, [c], 0, 255, -1) c_info.append({ 'x1': x, 'y1': y, 'x2': x + w - 1, 'y2': y + h - 1, 'sum': np.sum(ary * (c_im > 0))/255 }) return c_info def union_crops(crop1, crop2): """Union two (x1, y1, x2, y2) rects.""" x11, y11, x21, y21 = crop1 x12, y12, x22, y22 = crop2 return min(x11, x12), min(y11, y12), max(x21, x22), max(y21, y22) def intersect_crops(crop1, crop2): x11, y11, x21, y21 = crop1 x12, y12, x22, y22 = crop2 return max(x11, x12), max(y11, y12), min(x21, x22), min(y21, y22) def crop_area(crop): x1, y1, x2, y2 = crop return max(0, x2 - x1) * max(0, y2 - y1) def find_border_components(contours, ary): borders = [] area = ary.shape[0] * ary.shape[1] for i, c in enumerate(contours): x,y,w,h = cv2.boundingRect(c) if w * h > 0.5 * area: borders.append((i, x, y, x + w - 1, y + h - 1)) return borders def angle_from_right(deg): return min(deg % 90, 90 - (deg % 90)) def remove_border(contour, ary): """Remove everything outside a border contour.""" # Use a rotated rectangle (should be a good approximation of a border). # If it's far from a right angle, it's probably two sides of a border and # we should use the bounding box instead. c_im = np.zeros(ary.shape) r = cv2.minAreaRect(contour) degs = r[2] if angle_from_right(degs) <= 10: box = cv2.boxPoints(r) box = np.int0(box) cv2.drawContours(c_im, [box], 0, 255, -1) cv2.drawContours(c_im, [box], 0, 0, 4) else: x1, y1, x2, y2 = cv2.boundingRect(contour) cv2.rectangle(c_im, (x1, y1), (x2, y2), 255, -1) cv2.rectangle(c_im, (x1, y1), (x2, y2), 0, 4) return np.minimum(c_im, ary) def find_components(edges, max_components=16): """Dilate the image until there are just a few connected components. Returns contours for these components.""" # Perform increasingly aggressive dilation until there are just a few # connected components. count = 21 dilation = 5 n = 1 while count > 16: n += 1 dilated_image = dilate(edges, N=3, iterations=n) #_, contours, hierarchy = cv2.findContours(dilated_image, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) contours, hierarchy = cv2.findContours(dilated_image, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) count = len(contours) #print dilation #Image.fromarray(edges).show() #Image.fromarray(255 * dilated_image).show() return contours def find_optimal_components_subset(contours, edges): """Find a crop which strikes a good balance of coverage/compactness. Returns an (x1, y1, x2, y2) tuple. """ c_info = props_for_contours(contours, edges) c_info.sort(key=lambda x: -x['sum']) total = np.sum(edges) / 255 area = edges.shape[0] * edges.shape[1] c = c_info[0] del c_info[0] this_crop = c['x1'], c['y1'], c['x2'], c['y2'] crop = this_crop covered_sum = c['sum'] while covered_sum < total: changed = False recall = 1 * covered_sum / total prec = 1 - 1 * crop_area(crop) / area f1 = 2 * (prec * recall / (prec + recall)) #print '----' for i, c in enumerate(c_info): this_crop = c['x1'], c['y1'], c['x2'], c['y2'] new_crop = union_crops(crop, this_crop) new_sum = covered_sum + c['sum'] new_recall = 1 * new_sum / total new_prec = 1 - 1 * crop_area(new_crop) / area new_f1 = 2 * new_prec * new_recall / (new_prec + new_recall) # Add this crop if it improves f1 score, # _or_ it adds 25% of the remaining pixels for <15% crop expansion. # ^^^ very ad-hoc! make this smoother remaining_frac = c['sum'] / (total - covered_sum) new_area_frac = 1 * crop_area(new_crop) / crop_area(crop) - 1 if new_f1 > f1 or ( remaining_frac > 0.25 and new_area_frac < 0.15): print('%d %s -> %s / %s (%s), %s -> %s / %s (%s), %s -> %s' % ( i, covered_sum, new_sum, total, remaining_frac, crop_area(crop), crop_area(new_crop), area, new_area_frac, f1, new_f1)) crop = new_crop covered_sum = new_sum del c_info[i] changed = True break if not changed: break return crop def pad_crop(crop, contours, edges, border_contour, pad_px=15): """Slightly expand the crop to get full contours. This will expand to include any contours it currently intersects, but will not expand past a border. """ bx1, by1, bx2, by2 = 0, 0, edges.shape[0], edges.shape[1] if border_contour is not None and len(border_contour) > 0: c = props_for_contours([border_contour], edges)[0] bx1, by1, bx2, by2 = c['x1'] + 5, c['y1'] + 5, c['x2'] - 5, c['y2'] - 5 def crop_in_border(crop): x1, y1, x2, y2 = crop x1 = max(x1 - pad_px, bx1) y1 = max(y1 - pad_px, by1) x2 = min(x2 + pad_px, bx2) y2 = min(y2 + pad_px, by2) return crop crop = crop_in_border(crop) c_info = props_for_contours(contours, edges) changed = False for c in c_info: this_crop = c['x1'], c['y1'], c['x2'], c['y2'] this_area = crop_area(this_crop) int_area = crop_area(intersect_crops(crop, this_crop)) new_crop = crop_in_border(union_crops(crop, this_crop)) if 0 < int_area < this_area and crop != new_crop: print('%s -> %s' % (str(crop), str(new_crop))) changed = True crop = new_crop if changed: return pad_crop(crop, contours, edges, border_contour, pad_px) else: return crop def downscale_image(im, max_dim=2048): """Shrink im until its longest dimension is <= max_dim. Returns new_image, scale (where scale <= 1). """ a = im.shape[0] b = im.shape[1] if max(a, b) <= max_dim: return 1, im scale = 1 * max_dim / max(a, b) dim = (int(a * scale), int(b * scale)) new_im = cv2.resize(im, dim, interpolation = cv2.INTER_AREA) return scale, new_im def process_image(path, out_path): orig_im = Image.open(path) im = cv2.imread(path, cv2.IMREAD_GRAYSCALE) scale, im = downscale_image(im) edges = cv2.Canny(im, 100, 200) # TODO: dilate image _before_ finding a border. This is crazy sensitive! #_, contours, hierarchy = cv2.findContours(edges, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) contours, hierarchy = cv2.findContours(edges, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) borders = find_border_components(contours, edges) borders.sort(key=lambda i_x1_y1_x2_y2: (i_x1_y1_x2_y2[3] - i_x1_y1_x2_y2[1]) * (i_x1_y1_x2_y2[4] - i_x1_y1_x2_y2[2])) border_contour = None if len(borders): border_contour = contours[borders[0][0]] edges = remove_border(border_contour, edges) edges = 255 * (edges > 0).astype(np.uint8) # Remove ~1px borders using a rank filter. maxed_rows = rank_filter(edges, -5, size=(1, 20)) maxed_cols = rank_filter(edges, -5, size=(20, 1)) debordered = np.minimum(np.minimum(edges, maxed_rows), maxed_cols) edges = debordered contours = find_components(edges) if len(contours) == 0: print('%s -> (no text!)' % path) return crop = find_optimal_components_subset(contours, edges) crop = pad_crop(crop, contours, edges, border_contour) crop = [int(x / scale) for x in crop] # upscale to the original image size. # draw and show cropped rectangle area in the original image rgb_im = orig_im.convert('RGB') draw = ImageDraw.Draw(rgb_im) draw.rectangle(crop, outline='red') rgb_im.show() text_im = orig_im.crop(crop) text_im.show() text_im.save(out_path) print('%s -> %s' % (path, out_path)) if __name__ == '__main__': # path = 'images/text.jpg' path = 'images/scannedImage.png' out_path = 'croppedImage.png' try: process_image(path, out_path) except Exception as e: print('%s %s' % (path, e))
-
미해결[개정판] 파이썬 머신러닝 완벽 가이드
cross_val_score, GridSearchCV에서 cv 값
안녕하세요. 위 함수/모듈에서 cv값을 정하게 되면 train, test를 나누는 방법은 KFold인건지요? 만약 그렇다면, StratifiedKFold로 하려면 다른 방법이 있을까요?